Re: [PATCH] add: allow configurations to be overriden by command line

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] add: allow configurations to be overriden by command line

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:46:58

Stephen Boyd [off-list ref] writes:
Don't call git_config after parsing the command line options, otherwise
the config settings will override any settings made by the command line.
Amusing.

This dates back to the original 0d78153 (Do "git add" as a builtin,
2006-05-17).  It had two git_config() calls (one before command line
parsing, and then another).

Then 11be42a (Make git-mv a builtin, 2006-07-26) noticed this duplicate
calls, and removed the wrong one.

The calling sequence has been the same ever since; parse-opt-ification
5c46f75 (Port builtin-add.c to use the new option parser., 2007-10-03) 
did not affect it either.

Perhaps this deserves a test.  It is an ancient breakage nobody noticed so
far.

Thanks

Re: [PATCH] add: allow configurations to be overriden by command line

From: Stephen Boyd <hidden>
Date: 2016-06-15 22:46:58

Junio C Hamano wrote:
Perhaps this deserves a test.  It is an ancient breakage nobody noticed so
far
I didn't think it would be very useful, which is why I left it out. But
hey, at least it stops it from happening again. Squash it in if you want.
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index 6ce8256..91c1f7a 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -242,4 +242,13 @@ test_expect_success 'git add to resolve conflicts on otherwise ignored path' '
 	git add track-this
 '
 
+test_expect_success POSIXPERM '--no-ignore-errors overrides config' '
+	git config add.ignore-errors 1 &&
+	git reset --hard &&
+	date >foo1 &&
+	test_must_fail git add --verbose --no-ignore-errors . &&
+	! ( git ls-files foo1 | grep foo1 ) &&
+	git config add.ignore-errors 0
+'
+
 test_done
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help