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).

Signed-off-by: Johannes Schindelin <johannes.schinde...@gmx.de>
---
 reachable.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/reachable.c b/reachable.c
index 9cff25b..64289f3 100644
--- a/reachable.c
+++ b/reachable.c
@@ -25,9 +25,15 @@ static void update_progress(struct connectivity_progress *cp)
 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("ref is broken: %s", path);
+               return 0;
+       }
+
+       object = parse_object_or_die(oid->hash, path);
        add_pending_object(revs, object, "");
 
        return 0;
-- 
2.5.3.windows.1.3.gc322723



--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to