X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin%2Ffetch.c;h=d061e2c956123b5982024daba988776e4d8590f8;hb=fab47d057559301c74d6642576694fd251a3fd11;hp=7a4e41cca75b87d3e5a7c4690658d9879777e965;hpb=afc71aa9e62b4bce35472143f063022b13aba3b1;p=git.git diff --git a/builtin/fetch.c b/builtin/fetch.c index 7a4e41cca..d061e2c95 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -379,8 +379,10 @@ static int store_updated_refs(const char *raw_url, const char *remote_name, url = xstrdup("foreign"); rm = ref_map; - if (check_everything_connected(iterate_ref_map, 0, &rm)) - return error(_("%s did not send all necessary objects\n"), url); + if (check_everything_connected(iterate_ref_map, 0, &rm)) { + rc = error(_("%s did not send all necessary objects\n"), url); + goto abort; + } for (rm = ref_map; rm; rm = rm->next) { struct ref *ref = NULL; @@ -434,8 +436,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name, } note[note_len] = '\0'; fprintf(fp, "%s\t%s\t%s", - sha1_to_hex(commit ? commit->object.sha1 : - rm->old_sha1), + sha1_to_hex(rm->old_sha1), rm->merge ? "" : "not-for-merge", note); for (i = 0; i < url_len; ++i) @@ -462,12 +463,15 @@ static int store_updated_refs(const char *raw_url, const char *remote_name, fprintf(stderr, " %s\n", note); } } - free(url); - fclose(fp); + 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 " "branches"), remote_name); + + abort: + free(url); + fclose(fp); return rc; }