[PATCH v2 2/4] pack-objects: do not get distracted by broken symrefs
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Sep 28, 2015, 14:01 UTC
- Message-ID
- <b76346dee63408c37c8afe5366ce7133cdf29be2.1443448748.git.johannes.schindelin@gmx.de>
- In-Reply-To
- <cover.1443448748.git.johannes.schindelin@gmx.de>
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.schindelin@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