git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] pack-bitmap.c: typofix in `find_boundary_objects()`

From
Taylor Blau <me@ttaylorr.com>
Date
Nov 21, 2024, 22:50 UTC
Message-ID
<cf49115db4e8dcd406a17c946659c2eef3ec6045.1732229420.git.me@ttaylorr.com>

In the boundary-based bitmap traversal, we use the given 'rev_info' structure to first do a commit-only walk in order to determine the boundary between interesting and uninteresting objects.

That walk only looks at commit objects, regardless of the state of revs->blob_objects, revs->tree_objects, and so on. In order to do this, we store the state of these variables in temporary fields before setting them back to zero, performing the traversal, and then setting them back.

But there is a typo here that dates back to b0afdce5da (pack-bitmap.c: use commit boundary during bitmap traversal, 2023-05-08), where we incorrectly store the value of the "tags" field as "revs->blob_objects".

This could lead to problems later on if, say, the caller wants tag objects but *not* blob objects. In the pre-image behavior, we'd set revs->tag_objects back to the old value of revs->blob_objects, thus emitting fewer objects than expected back to the caller.

Fix that by correctly assigning the value of 'revs->tag_objects' to the 'tmp_tags' field.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
Noticed while I was looking for an example of this pattern somewhere in
the codebase and was surprised when I found this typo ;-).
 pack-bitmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pack-bitmap.c b/pack-bitmap.c
index 4fa9dfc771..683f467051 100644
--- a/pack-bitmap.c
+++ b/pack-bitmap.c
@@ -1270,7 +1270,7 @@ static struct bitmap *find_boundary_objects(struct bitmap_index *bitmap_git,

 	tmp_blobs = revs->blob_objects;
 	tmp_trees = revs->tree_objects;
-	tmp_tags = revs->blob_objects;
+	tmp_tags = revs->tag_objects;
 	revs->blob_objects = 0;
 	revs->tree_objects = 0;
 	revs->tag_objects = 0;

base-commit: 4083a6f05206077a50af7658bedc17a94c54607d
--
2.47.0.237.gc601277f4c4
Next: Junio C Hamano
Message 1 of 5 in “pack-bitmap.c: typofix in `find_boundary_objects()`”
  1. pack-bitmap.c: typofix in `find_boundary_objects()`Taylor Blau, Nov 21, 2024
  2. Junio C HamanoNov 22, 2024
  3. Jeff KingNov 22, 2024
  4. Jeff KingNov 22, 2024
  5. Junio C HamanoNov 25, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.