diff options
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | 2007-10-11 01:47:55 +0100 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2007-10-16 01:24:18 -0400 |
commit | da0204df587ae76cd291bc7e495fc60d873c2f20 (patch) | |
tree | 055c4c2ee5fcbbe3887ef4d9383d8b34bfa90104 /builtin-fetch.c | |
parent | fe5d1d3eb42e6cf3dca93b2277be9464b026fcf2 (diff) | |
download | git-da0204df587ae76cd291bc7e495fc60d873c2f20.tar.gz |
fetch: if not fetching from default remote, ignore default merge
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>
Diffstat (limited to 'builtin-fetch.c')
-rw-r--r-- | builtin-fetch.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/builtin-fetch.c b/builtin-fetch.c index caaca63644..3442f3d09e 100644 --- a/builtin-fetch.c +++ b/builtin-fetch.c @@ -105,7 +105,13 @@ static struct ref *get_ref_map(struct transport *transport, !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"); |