Skip to content

Commit d1f6c18

Browse files
committed
Merge branch 'sb/maint-1.6.0-add-config-fix' into maint
* sb/maint-1.6.0-add-config-fix: add: allow configurations to be overriden by command line
2 parents cff4231 + ed342fd commit d1f6c18

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

builtin-add.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,15 +250,15 @@ int cmd_add(int argc, const char **argv, const char *prefix)
250250
int add_new_files;
251251
int require_pathspec;
252252

253+
git_config(add_config, NULL);
254+
253255
argc = parse_options(argc, argv, builtin_add_options,
254256
builtin_add_usage, 0);
255257
if (patch_interactive)
256258
add_interactive = 1;
257259
if (add_interactive)
258260
exit(interactive_add(argc, argv, prefix));
259261

260-
git_config(add_config, NULL);
261-
262262
if (addremove && take_worktree_changes)
263263
die("-A and -u are mutually incompatible");
264264
if ((addremove || take_worktree_changes) && !argc) {

t/t3700-add.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,19 @@ test_expect_success POSIXPERM 'git add (add.ignore-errors = false)' '
221221
test_must_fail git add --verbose . &&
222222
! ( git ls-files foo1 | grep foo1 )
223223
'
224+
rm -f foo2
225+
226+
test_expect_success '--no-ignore-errors overrides config' '
227+
git config add.ignore-errors 1 &&
228+
git reset --hard &&
229+
date >foo1 &&
230+
date >foo2 &&
231+
chmod 0 foo2 &&
232+
test_must_fail git add --verbose --no-ignore-errors . &&
233+
! ( git ls-files foo1 | grep foo1 ) &&
234+
git config add.ignore-errors 0
235+
'
236+
rm -f foo2
224237

225238
test_expect_success BSLASHPSPEC "git add 'fo\\[ou\\]bar' ignores foobar" '
226239
git reset --hard &&

0 commit comments

Comments
 (0)