Skip to content

Commit

Permalink
reachable: mark index blobs as SEEN
Browse files Browse the repository at this point in the history
When we mark all reachable objects for pruning, that
includes blobs mentioned by the index. However, we do not
mark these with the SEEN flag, as we do for objects that we
find by traversing (we also do not add them to the pending
list, but that is because there is nothing further to
traverse with them).

This doesn't cause any problems with prune, because it
checks only that the object exists in the global object
hash, and not its flags. However, let's mark these objects
to be consistent and avoid any later surprises.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Oct 16, 2014
1 parent 27e1e22 commit 3725427
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion reachable.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ static void add_cache_refs(struct rev_info *revs)

read_cache();
for (i = 0; i < active_nr; i++) {
struct blob *blob;

/*
* The index can contain blobs and GITLINKs, GITLINKs are hashes
* that don't actually point to objects in the repository, it's
Expand All @@ -65,7 +67,10 @@ static void add_cache_refs(struct rev_info *revs)
if (S_ISGITLINK(active_cache[i]->ce_mode))
continue;

lookup_blob(active_cache[i]->sha1);
blob = lookup_blob(active_cache[i]->sha1);
if (blob)
blob->object.flags |= SEEN;

/*
* We could add the blobs to the pending list, but quite
* frankly, we don't care. Once we've looked them up, and
Expand Down

0 comments on commit 3725427

Please sign in to comment.