summaryrefslogtreecommitdiffstats
path: root/Utilities/GitSetup/setup-user
diff options
context:
space:
mode:
authorArkadiusz Drabczyk <arkadiusz@drabczyk.org>2019-11-24 18:10:56 (GMT)
committerArkadiusz Drabczyk <arkadiusz@drabczyk.org>2019-11-24 18:10:56 (GMT)
commit5129e97285339ad0a481ffdd148bb9e09848a2f4 (patch)
treef2c4ac6296c2914d1a170cd730f5647b05d4a204 /Utilities/GitSetup/setup-user
parentadc50529ac163889c0353756706a7ffddb4ed957 (diff)
downloadCMake-5129e97285339ad0a481ffdd148bb9e09848a2f4.zip
CMake-5129e97285339ad0a481ffdd148bb9e09848a2f4.tar.gz
CMake-5129e97285339ad0a481ffdd148bb9e09848a2f4.tar.bz2
setup-user: switch to git-var to check if username and e-mail are set
In git, apart from setting username and e-mail in .gitconfig it's also possible to set username in /etc/passwd and set e-mail using EMAIL environment variable. The advantage of this method is that other programs such as mutt or doxygen will pick up these settings up so there is no need to set them separately in each program. Current way of checking if username and e-mail are set using git config results in failure if they are set using this method.
Diffstat (limited to 'Utilities/GitSetup/setup-user')
-rwxr-xr-xUtilities/GitSetup/setup-user8
1 files changed, 4 insertions, 4 deletions
diff --git a/Utilities/GitSetup/setup-user b/Utilities/GitSetup/setup-user
index 1af439c..0b98879 100755
--- a/Utilities/GitSetup/setup-user
+++ b/Utilities/GitSetup/setup-user
@@ -20,12 +20,12 @@
# 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
+ ident="$(git var GIT_AUTHOR_IDENT 2>/dev/null | rev | cut -d' ' -f3- | rev)"
+
+ 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