path: root/reachable.c
diff options
authorJeff King <>2014-10-15 22:40:37 (GMT)
committerJunio C Hamano <>2014-10-16 17:10:40 (GMT)
commit3725427945657da052f2f833f5fd4616c949be3e (patch)
treea43fa1c991ee8f077b3e0b73c686bd59c281dda1 /reachable.c
parent27e1e22d5ee3005f228b67ea94b5af29547b54fe (diff)
reachable: mark index blobs as SEEN
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 <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'reachable.c')
1 files changed, 6 insertions, 1 deletions
diff --git a/reachable.c b/reachable.c
index 4e68cfa..d03f829 100644
--- a/reachable.c
+++ b/reachable.c
@@ -55,6 +55,8 @@ static void add_cache_refs(struct rev_info *revs)
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
@@ -65,7 +67,10 @@ static void add_cache_refs(struct rev_info *revs)
if (S_ISGITLINK(active_cache[i]->ce_mode))
- 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