summaryrefslogtreecommitdiff
path: root/reachable.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-10-15 22:43:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-10-15 22:43:51 (GMT)
commit1018f3eea40875843ece4131e662ec3e32a3ab06 (patch)
treede0d7fd953157850734daa515cdc310f1aed07e6 /reachable.c
parentdb5adf24bf6e0380d4b4ce97f88b4f874773f424 (diff)
parent14886b40c552d3ad4d5492d922948d76762af198 (diff)
downloadgit-1018f3eea40875843ece4131e662ec3e32a3ab06.zip
git-1018f3eea40875843ece4131e662ec3e32a3ab06.tar.gz
git-1018f3eea40875843ece4131e662ec3e32a3ab06.tar.bz2
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
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 9cff25b..43616d4 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("symbolic ref is dangling: %s", path);
+ return 0;
+ }
+
+ object = parse_object_or_die(oid->hash, path);
add_pending_object(revs, object, "");
return 0;