summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGitSetup Upstream <kwrobot@kitware.com>2020-04-17 14:12:23 (GMT)
committerBrad King <brad.king@kitware.com>2020-04-17 14:13:26 (GMT)
commit58696abdfe9ceaddccec60bd65e03da39addbcc9 (patch)
treede35d8eae2bb06df3003e89d6367d2064c92bb23
parentf223a7caf494949c241133b7a7a1408738d6b376 (diff)
downloadCMake-58696abdfe9ceaddccec60bd65e03da39addbcc9.zip
CMake-58696abdfe9ceaddccec60bd65e03da39addbcc9.tar.gz
CMake-58696abdfe9ceaddccec60bd65e03da39addbcc9.tar.bz2
GitSetup 2020-04-17 (b162f746)
Code extracted from: https://gitlab.kitware.com/utils/gitsetup.git at commit b162f7465b8163be49ba6d0ea9400f418c2fbb9d (setup).
-rwxr-xr-xsetup-user15
1 files changed, 11 insertions, 4 deletions
diff --git a/setup-user b/setup-user
index 1af439c..4cbd184 100755
--- a/setup-user
+++ b/setup-user
@@ -20,12 +20,19 @@
# Project configuration instructions: NONE
for (( ; ; )); do
- user_name=$(git config user.name || echo '') &&
- user_email=$(git config user.email || echo '') &&
- if test -n "$user_name" -a -n "$user_email"; then
+ if type -p rev >/dev/null && type -p cut >/dev/null; then
+ ident="$(git var GIT_AUTHOR_IDENT 2>/dev/null | rev | cut -d' ' -f3- | rev)"
+ elif user_name=$(git config --get user.name) &&
+ user_email=$(git config --get user.email); then
+ ident="$user_name <$user_email>"
+ else
+ ident=""
+ fi
+
+ if test -n "$ident"; then
echo 'Your commits will record as Author:
- '"$user_name <$user_email>"'
+ '"$ident"'
' &&
read -ep 'Is the author name and email address above correct? [Y/n] ' correct &&
if test "$correct" != "n" -a "$correct" != "N"; then