Skip to content

Commit 09236d8

Browse files
committed
Merge branch 'sb/maint-1.6.0-add-config-fix'
* sb/maint-1.6.0-add-config-fix: add: allow configurations to be overriden by command line use xstrdup, not strdup in ll-merge.c Conflicts: builtin-add.c
2 parents 7c74c39 + ed342fd commit 09236d8

3 files changed

Lines changed: 19 additions & 6 deletions

File tree

builtin-add.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,15 +298,15 @@ int cmd_add(int argc, const char **argv, const char *prefix)
298298
int add_new_files;
299299
int require_pathspec;
300300

301+
git_config(add_config, NULL);
302+
301303
argc = parse_options(argc, argv, prefix, builtin_add_options,
302304
builtin_add_usage, PARSE_OPT_KEEP_ARGV0);
303305
if (patch_interactive)
304306
add_interactive = 1;
305307
if (add_interactive)
306308
exit(interactive_add(argc - 1, argv + 1, prefix));
307309

308-
git_config(add_config, NULL);
309-
310310
if (edit_interactive)
311311
return(edit_patch(argc, argv, prefix));
312312
argc--;

ll-merge.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ static int read_merge_config(const char *var, const char *value, void *cb)
231231

232232
if (!strcmp(var, "merge.default")) {
233233
if (value)
234-
default_ll_merge = strdup(value);
234+
default_ll_merge = xstrdup(value);
235235
return 0;
236236
}
237237

@@ -265,7 +265,7 @@ static int read_merge_config(const char *var, const char *value, void *cb)
265265
if (!strcmp("name", ep)) {
266266
if (!value)
267267
return error("%s: lacks value", var);
268-
fn->description = strdup(value);
268+
fn->description = xstrdup(value);
269269
return 0;
270270
}
271271

@@ -288,14 +288,14 @@ static int read_merge_config(const char *var, const char *value, void *cb)
288288
* file named by %A, and signal that it has done with zero exit
289289
* status.
290290
*/
291-
fn->cmdline = strdup(value);
291+
fn->cmdline = xstrdup(value);
292292
return 0;
293293
}
294294

295295
if (!strcmp("recursive", ep)) {
296296
if (!value)
297297
return error("%s: lacks value", var);
298-
fn->recursive = strdup(value);
298+
fn->recursive = xstrdup(value);
299299
return 0;
300300
}
301301

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)