diff --git a/builtin/fetch.c b/builtin/fetch.c index 33ad3aa..e2f2c69 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -376,6 +376,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name, struct strbuf note = STRBUF_INIT; const char *what, *kind; struct ref *rm; + int top = 1; char *url, *filename = dry_run ? "/dev/null" : git_path("FETCH_HEAD"); fp = fopen(filename, "a"); @@ -393,6 +394,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name, goto abort; } + write: for (rm = ref_map; rm; rm = rm->next) { struct ref *ref = NULL; @@ -408,6 +410,9 @@ static int store_updated_refs(const char *raw_url, const char *remote_name, if (!commit) rm->merge = 0; + if (top != rm->merge) + continue; + if (!strcmp(rm->name, "HEAD")) { kind = ""; what = ""; @@ -474,6 +479,11 @@ static int store_updated_refs(const char *raw_url, const char *remote_name, } } + if (top) { + top = 0; + goto write; + } + if (rc & STORE_REF_ERROR_DF_CONFLICT) error(_("some local refs could not be updated; try running\n" " 'git remote prune %s' to remove any old, conflicting "