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

[PATCH v7 6/7] pack-bitmap-write.c: don't return without stop_progress()

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Dec 17, 2021, 04:25 UTC
Message-ID
<patch-v7-6.7-776362de897-20211217T041945Z-avarab@gmail.com>
In-Reply-To
<cover-v7-0.7-00000000000-20211217T041945Z-avarab@gmail.com>

Fix a bug that's been here since 7cc8f971085 (pack-objects: implement bitmap writing, 2013-12-21), we did not call stop_progress() if we reached the early exit in this function.

We could call stop_progress() before we return, but better yet is to defer calling start_progress() until we need it.

This will matter in a subsequent commit where we BUG(...) out if this happens, and matters now e.g. because we don't have a corresponding "region_end" for the progress trace2 event.

Suggested-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 pack-bitmap-write.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c
index 9c55c1531e1..cab3eaa2acd 100644
--- a/pack-bitmap-write.c
+++ b/pack-bitmap-write.c
@@ -575,15 +575,15 @@ void bitmap_writer_select_commits(struct commit **indexed_commits,
 
 	QSORT(indexed_commits, indexed_commits_nr, date_compare);
 
-	if (writer.show_progress)
-		writer.progress = start_progress("Selecting bitmap commits", 0);
-
 	if (indexed_commits_nr < 100) {
 		for (i = 0; i < indexed_commits_nr; ++i)
 			push_bitmapped_commit(indexed_commits[i]);
 		return;
 	}
 
+	if (writer.show_progress)
+		writer.progress = start_progress("Selecting bitmap commits", 0);
+
 	for (;;) {
 		struct commit *chosen = NULL;
 
-- 
2.34.1.1119.g7a3fc8778ee
Previous: Junio C HamanoNext: Johannes Altmanninger
Message 13 of 16 in “progress: test fixes / cleanup”
  1. 0/7 progress: test fixes / cleanupÆvar Arnfjörð Bjarmason, Dec 17, 2021
  2. 1/7 leak tests: fix a memory leaks in "test-progress" helperÆvar Arnfjörð Bjarmason, Dec 17, 2021
  3. Johannes AltmanningerDec 27, 2021
  4. 2/7 progress.c test helper: add missing bracesÆvar Arnfjörð Bjarmason, Dec 17, 2021
  5. 3/7 progress.c tests: make start/stop commands on stdinÆvar Arnfjörð Bjarmason, Dec 17, 2021
  6. Johannes AltmanningerDec 27, 2021
  7. Ævar Arnfjörð BjarmasonDec 27, 2021
  8. 5/7 progress.c: add temporary variable from progress structÆvar Arnfjörð Bjarmason, Dec 17, 2021
  9. Johannes AltmanningerDec 27, 2021
  10. 4/7 progress.c tests: test some invalid usageÆvar Arnfjörð Bjarmason, Dec 17, 2021
  11. Johannes AltmanningerDec 27, 2021
  12. Junio C HamanoJan 3, 2022
  13. 6/7 pack-bitmap-write.c: don't return without stop_progress()Ævar Arnfjörð Bjarmason, Dec 17, 2021
  14. Johannes AltmanningerDec 27, 2021
  15. 7/7 various *.c: use isatty(0|2), not isatty(STDIN_FILENO|STDERR_FILENO)Ævar Arnfjörð Bjarmason, Dec 17, 2021
  16. Johannes AltmanningerDec 27, 2021

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.