Skip to content

Commit 3725427

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 27e1e22 commit 3725427

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

reachable.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ static void add_cache_refs(struct rev_info *revs)
5555

5656
read_cache();
5757
for (i = 0; i < active_nr; i++) {
58+
struct blob *blob;
59+
5860
/*
5961
* The index can contain blobs and GITLINKs, GITLINKs are hashes
6062
* 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)
6567
if (S_ISGITLINK(active_cache[i]->ce_mode))
6668
continue;
6769

68-
lookup_blob(active_cache[i]->sha1);
70+
blob = lookup_blob(active_cache[i]->sha1);
71+
if (blob)
72+
blob->object.flags |= SEEN;
73+
6974
/*
7075
* We could add the blobs to the pending list, but quite
7176
* frankly, we don't care. Once we've looked them up, and

0 commit comments

Comments
 (0)