Skip to content

Commit

Permalink
Merge branch 'sb/maint-1.6.0-add-config-fix'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Junio C Hamano committed Jun 21, 2009
2 parents 7c74c39 + ed342fd commit 09236d8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
4 changes: 2 additions & 2 deletions builtin-add.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,15 @@ int cmd_add(int argc, const char **argv, const char *prefix)
int add_new_files;
int require_pathspec;

git_config(add_config, NULL);

argc = parse_options(argc, argv, prefix, builtin_add_options,
builtin_add_usage, PARSE_OPT_KEEP_ARGV0);
if (patch_interactive)
add_interactive = 1;
if (add_interactive)
exit(interactive_add(argc - 1, argv + 1, prefix));

git_config(add_config, NULL);

if (edit_interactive)
return(edit_patch(argc, argv, prefix));
argc--;
Expand Down
8 changes: 4 additions & 4 deletions ll-merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ static int read_merge_config(const char *var, const char *value, void *cb)

if (!strcmp(var, "merge.default")) {
if (value)
default_ll_merge = strdup(value);
default_ll_merge = xstrdup(value);
return 0;
}

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

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

if (!strcmp("recursive", ep)) {
if (!value)
return error("%s: lacks value", var);
fn->recursive = strdup(value);
fn->recursive = xstrdup(value);
return 0;
}

Expand Down
13 changes: 13 additions & 0 deletions t/t3700-add.sh
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,19 @@ test_expect_success POSIXPERM 'git add (add.ignore-errors = false)' '
test_must_fail git add --verbose . &&
! ( git ls-files foo1 | grep foo1 )
'
rm -f foo2

test_expect_success '--no-ignore-errors overrides config' '
git config add.ignore-errors 1 &&
git reset --hard &&
date >foo1 &&
date >foo2 &&
chmod 0 foo2 &&
test_must_fail git add --verbose --no-ignore-errors . &&
! ( git ls-files foo1 | grep foo1 ) &&
git config add.ignore-errors 0
'
rm -f foo2

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

0 comments on commit 09236d8

Please sign in to comment.