summaryrefslogtreecommitdiff
path: root/reachable.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2015-09-28 16:01:25 +0200
committerJunio C Hamano <gitster@pobox.com>2015-10-08 12:42:06 -0700
commit14886b40c552d3ad4d5492d922948d76762af198 (patch)
tree9cc35d6373299ae26e6e37bdba01ec4c2688873b /reachable.c
parent8c845cde99dcfc9821f1182623248dee9ebb4227 (diff)
downloadgit-14886b40c552d3ad4d5492d922948d76762af198.tar.gz
pack-objects: do not get distracted by broken symrefsjs/gc-with-stale-symref
It is quite possible for, say, a remote HEAD to become broken, e.g. when the default branch was renamed. We should still be able to pack our objects when such a thing happens; simply ignore broken symrefs (because they cannot matter for the packing process anyway). This fixes https://github.com/git-for-windows/git/issues/423 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reachable.c')
-rw-r--r--reachable.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/reachable.c b/reachable.c
index 69fa6851da..4cfd0dec70 100644
--- a/reachable.c
+++ b/reachable.c
@@ -24,9 +24,15 @@ static void update_progress(struct connectivity_progress *cp)
static int add_one_ref(const char *path, const unsigned char *sha1, int flag, void *cb_data)
{
- struct object *object = parse_object_or_die(sha1, 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);
add_pending_object(revs, object, "");
return 0;