Skip to content

Commit 773a69f

Browse files
raalkmlgitster
authored andcommitted
Add a test for git-config --file
Check for non-0 exit code if the confiog file does not exist and if it works exactly like when setting GIT_CONFIG. Signed-off-by: Alex Riesen <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 67d454f commit 773a69f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

t/t1300-repo-config.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,9 @@ EOF
325325

326326
test_expect_success 'new variable inserts into proper section' 'cmp .git/config expect'
327327

328+
test_expect_success 'alternative GIT_CONFIG (non-existing file should fail)' \
329+
'git config --file non-existing-config -l; test $? != 0'
330+
328331
cat > other-config << EOF
329332
[ein]
330333
bahn = strasse
@@ -338,6 +341,9 @@ GIT_CONFIG=other-config git config -l > output
338341

339342
test_expect_success 'alternative GIT_CONFIG' 'cmp output expect'
340343

344+
test_expect_success 'alternative GIT_CONFIG (--file)' \
345+
'git config --file other-config -l > output && cmp output expect'
346+
341347
GIT_CONFIG=other-config git config anwohner.park ausweis
342348

343349
cat > expect << EOF

0 commit comments

Comments
 (0)