summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fe5d1d3)
raw | patch | inline | side by side (parent: fe5d1d3)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Thu, 11 Oct 2007 00:47:55 +0000 (01:47 +0100) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Tue, 16 Oct 2007 05:24:18 +0000 (01:24 -0400) |
When doing "git fetch <remote>" on a remote that does not have the
branch referenced in branch.<current-branch>.merge, git fetch failed.
It failed because it tried to add the "merge" ref to the refs to be
fetched.
Fix that. And add a test case.
Incidentally, this unconvered a bug in our own test suite, where
"git pull <some-path>" was expected to merge the ref given in the
defaults, even if not pulling from the default remote.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
branch referenced in branch.<current-branch>.merge, git fetch failed.
It failed because it tried to add the "merge" ref to the refs to be
fetched.
Fix that. And add a test case.
Incidentally, this unconvered a bug in our own test suite, where
"git pull <some-path>" was expected to merge the ref given in the
defaults, even if not pulling from the default remote.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
builtin-fetch.c | patch | blob | history | |
t/t5510-fetch.sh | patch | blob | history | |
t/t5700-clone-reference.sh | patch | blob | history |
diff --git a/builtin-fetch.c b/builtin-fetch.c
index caaca63644b91b414d808079e14aee38c2a6eda7..3442f3d09e8078bd9cd1213b81ee64fb69c9c3c1 100644 (file)
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
!remote->fetch[0].pattern)
ref_map->merge = 1;
}
- if (has_merge)
+ /*
+ * if the remote we're fetching from is the same
+ * as given in branch.<name>.remote, we add the
+ * ref given in branch.<name>.merge, too.
+ */
+ if (has_merge && !strcmp(branch->remote_name,
+ remote->name))
add_merge_config(&ref_map, remote_refs, branch, &tail);
} else {
ref_map = get_remote_ref(remote_refs, "HEAD");
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 40ebf2e2bf705888795c7ff8f40e5e27203c4e3f..d2176571462af7dd66ecdb197731cd9d810dccdf 100755 (executable)
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
'
}
+test_expect_success 'fetch with a non-applying branch.<name>.merge' '
+ git config branch.master.remote yeti &&
+ git config branch.master.merge refs/heads/bigfoot &&
+ git config remote.blub.url one &&
+ git config remote.blub.fetch "refs/heads/*:refs/remotes/one/*" &&
+ git fetch blub
+'
+
test_done
index 4e93aaab02e7b84b4bcf6ac70515e6cf52f0dabc..b6a54867b491ba67e4813fd492a1a8cc16959a21 100755 (executable)
test_expect_success 'pulling from reference' \
'cd C &&
-git pull ../B'
+git pull ../B master'
cd "$base_dir"
cd "$base_dir"
test_expect_success 'pulling from reference' \
-'cd D && git pull ../B'
+'cd D && git pull ../B master'
cd "$base_dir"