From: Junio C Hamano Date: Thu, 15 Oct 2015 22:43:51 +0000 (-0700) Subject: Merge branch 'js/gc-with-stale-symref' X-Git-Tag: v2.7.0-rc0~97 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/1018f3eea40875843ece4131e662ec3e32a3ab06 Merge branch 'js/gc-with-stale-symref' "git gc" used to barf when a symbolic ref has gone dangling (e.g. the branch that used to be your upstream's default when you cloned from it is now gone, and you did "fetch --prune"). * js/gc-with-stale-symref: pack-objects: do not get distracted by broken symrefs gc: demonstrate failure with stale remote HEAD --- 1018f3eea40875843ece4131e662ec3e32a3ab06 diff --cc reachable.c index 9cff25b490,4cfd0dec70..43616d49c7 --- a/reachable.c +++ b/reachable.c @@@ -22,12 -22,17 +22,18 @@@ static void update_progress(struct conn display_progress(cp->progress, cp->count); } -static int add_one_ref(const char *path, const unsigned char *sha1, int flag, void *cb_data) +static int add_one_ref(const char *path, const struct object_id *oid, + int flag, void *cb_data) { - struct object *object = parse_object_or_die(oid->hash, path); struct rev_info *revs = (struct rev_info *)cb_data; + struct object *object; + if ((flag & REF_ISSYMREF) && (flag & REF_ISBROKEN)) { + warning("symbolic ref is dangling: %s", path); + return 0; + } + - object = parse_object_or_die(sha1, path); ++ object = parse_object_or_die(oid->hash, path); add_pending_object(revs, object, ""); return 0;