summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 13e65fe)
raw | patch | inline | side by side (parent: 13e65fe)
author | Junio C Hamano <gitster@pobox.com> | |
Wed, 24 Feb 2010 18:22:06 +0000 (10:22 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 24 Feb 2010 18:51:07 +0000 (10:51 -0800) |
When running a subfetch, the code propagated some options but not others.
Propagate --force, --update-head-ok and --keep options as well.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Propagate --force, --update-head-ok and --keep options as well.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-fetch.c | patch | blob | history | |
t/t5521-pull-options.sh | patch | blob | history |
diff --git a/builtin-fetch.c b/builtin-fetch.c
index 8654fa7a2dbe2c1ca76a493a4322447de5219b99..61b2e4060c0802492520cf94f23d2063e24de684 100644 (file)
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
static int fetch_multiple(struct string_list *list)
{
int i, result = 0;
- const char *argv[] = { "fetch", NULL, NULL, NULL, NULL, NULL, NULL };
+ const char *argv[10] = { "fetch" };
int argc = 1;
if (dry_run)
argv[argc++] = "--dry-run";
if (prune)
argv[argc++] = "--prune";
+ if (update_head_ok)
+ argv[argc++] = "--update-head-ok";
+ if (force)
+ argv[argc++] = "--force";
+ if (keep)
+ argv[argc++] = "--keep";
if (verbosity >= 2)
argv[argc++] = "-v";
if (verbosity >= 1)
for (i = 0; i < list->nr; i++) {
const char *name = list->items[i].string;
argv[argc] = name;
+ argv[argc + 1] = NULL;
if (verbosity >= 0)
printf("Fetching %s\n", name);
if (run_command_v_opt(argv, RUN_GIT_CMD)) {
index c18d82973fb75f3a17d4b7657f2168418c125457..84059d82d5061870e6932a4d82327110b4c89875 100755 (executable)
--- a/t/t5521-pull-options.sh
+++ b/t/t5521-pull-options.sh
test -s err)
'
+test_expect_success 'git pull --force' '
+ mkdir clonedoldstyle &&
+ (cd clonedoldstyle && git init &&
+ cat >>.git/config <<-\EOF &&
+ [remote "one"]
+ url = ../parent
+ fetch = refs/heads/master:refs/heads/mirror
+ [remote "two"]
+ url = ../parent
+ fetch = refs/heads/master:refs/heads/origin
+ [branch "master"]
+ remote = two
+ merge = refs/heads/master
+ EOF
+ git pull two &&
+ test_commit A &&
+ git branch -f origin &&
+ git pull --all --force
+ )
+'
+
test_done