Skip to content

Commit 20d6358

Browse files
committed
If possible copy locally configured username and email from parent folder
1 parent a281489 commit 20d6358

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ set-dds-env.sh
33
token
44
git-issue.pdf
55
git-issue.ps
6+
git-issue

git-issue.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ USAGE_new_EOF
222222

223223
sub_init()
224224
{
225-
local existing
225+
local existing username useremail
226226

227227
while getopts e flag ; do
228228
case $flag in
@@ -238,6 +238,8 @@ sub_init()
238238

239239
test -d .issues && error 'An .issues directory is already present'
240240
mkdir .issues || error 'Unable to create .issues directory'
241+
username=`git config --local user.name`
242+
useremail=`git config --local user.email`
241243
cdissues
242244
if ! [ "$existing" ] ; then
243245
git init -q || error 'Unable to initialize Git directory'
@@ -273,6 +275,12 @@ This is an distributed issue tracking repository based on Git.
273275
Visit [git-issue](https://github.com/dspinellis/git-issue) for more information.
274276
EOF
275277
git add config README.md templates/comment templates/description
278+
if [ -n "$username" ] ; then
279+
git config --local user.name "$username"
280+
fi
281+
if [ -n "$useremail" ] ; then
282+
git config --local user.email "$useremail"
283+
fi
276284
commit 'gi: Initialize issues repository' 'gi init'
277285
echo "Initialized empty issues repository in $(pwd)"
278286
}
@@ -951,7 +959,7 @@ sub_edit()
951959
;;
952960
esac
953961
done
954-
962+
955963
shift $((OPTIND - 1));
956964
test -n "$1" || usage_edit
957965

test.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ TopDir=$(mktemp -d)
161161
} 1>&2
162162

163163
if command -v gdate ; then
164-
DATEBIN="gdate"
164+
DATEBIN="gdate"
165165
else
166166
DATEBIN="date"
167167
fi
@@ -199,10 +199,16 @@ cd "$TopDir"
199199

200200
mkdir testdir
201201
cd testdir
202+
git init > /dev/null 2>&1;
203+
git config --local user.name "Joe"
204+
git config --local user.email "joe@example.com"
205+
echo ".issues" > .gitignore
202206

203207
try "$gi" init
204208
try "$gi" list
205209

210+
start ; ( cd .issues; git config --local user.name ) | try_grep "Joe"
211+
start ; ( cd .issues; git config --local user.email ) | try_grep "joe@example.com"
206212
start ; "$gi" list "$issue" | try_ngrep .
207213

208214
# New
@@ -517,11 +523,11 @@ else
517523
start ; "$gi" show -c "$rissue" | try_grep '^ *comment 1 line 2'
518524
start ; "$gi" show -c "$rissue" | try_grep '^ *comment 2'
519525
start ; "$gi" show -c "$rissue" | try_grep '^ *comment 4'
520-
526+
521527
start ; "$gi" show "$rissue2" | try_grep '^Milestone: ver4'
522528
rissue3=$("$gi" list | awk '/An open issue on GitHub with assignees and tags/ {print $1}')
523529
start ; "$gi" show "$rissue3" | try_grep 'good first issue'
524-
530+
525531
cd ../testdir
526532

527533
# delete repo

0 commit comments

Comments
 (0)