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

Re: [PATCH] pack-objects: Print a message describing the number of threads for packing

From
Jeff King <peff@peff.net>
Date
Feb 26, 2008, 09:33 UTC
Message-ID
<20080226093300.GA5812@coredump.intra.peff.net>
In-Reply-To
<7vablo848d.fsf@gitster.siamese.dyndns.org>
On Tue, Feb 26, 2008 at 01:19:14AM -0800, Junio C Hamano wrote:
> But now you mention it, I tend to agree with you.  This is
> primarily of interest for git developers and I do not think the
> end users would care.  Maybe under --verbose or --debug option
> (but I do not think we have --debug option anywhere).

I wrote up a --verbose patch, but it just seemed silly. Who would actually turn it on?

How about this instead?

-- >8 -- pack-objects: show "using N threads" only when autodetected

Every other case is uninteresting, since either:
  - it is the default of 1, in which case we are always just
    printing "using 1 thread"
  - it is whatever the user set it to, in which case they
    already know

But with --threads=0, they might want to be informed of the number of CPUs detected. --- If we ever change the default to autodetect, this logic might change, but we can deal with that then.

BTW, I seem to remember some work recently on coalescing hunks in merge conflicts separated by a small number of lines. It seems to me that the diff below would be easier to read with a similar tactic.

 builtin-pack-objects.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index b70b2e5..516eb24 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -2236,11 +2236,12 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
 		die("--thin cannot be used to build an indexable pack.");
 
 #ifdef THREADED_DELTA_SEARCH
-	if (!delta_search_threads)	/* --threads=0 means autodetect */
+	if (!delta_search_threads) {	/* --threads=0 means autodetect */
 		delta_search_threads = online_cpus();
-	if (progress)
-		fprintf(stderr, "Using %d pack threads.\n",
-			delta_search_threads);
+		if (progress)
+			fprintf(stderr, "Using %d pack threads.\n",
+					delta_search_threads);
+	}
 #endif
 
 	prepare_packed_git();
-- 
1.5.4.3.340.gda2e.dirty
Previous: Junio C HamanoNext: Andreas Ericsson
Message 15 of 22 in “pack-objects: Add runtime detection of online CPU's”
  1. pack-objects: Add runtime detection of online CPU'sAndreas Ericsson, Feb 12, 2008
  2. Shawn O. PearceFeb 12, 2008
  3. Johannes SixtFeb 12, 2008
  4. Bert WesargFeb 12, 2008
  5. Andreas EricssonFeb 12, 2008
  6. Michael HendricksFeb 12, 2008
  7. Brandon CaseyFeb 12, 2008
  8. pack-objects: Add runtime detection of online CPU'sBrandon Casey, Feb 23, 2008
  9. Andreas EricssonFeb 23, 2008
  10. pack-objects: Print a message describing the number of threads for packingBrandon Casey, Feb 23, 2008
  11. Jeff KingFeb 26, 2008
  12. Junio C HamanoFeb 26, 2008
  13. Jeff KingFeb 26, 2008
  14. Junio C HamanoFeb 26, 2008
  15. Jeff KingFeb 26, 2008
  16. Andreas EricssonFeb 26, 2008
  17. Brandon CaseyFeb 26, 2008
  18. Nicolas PitreFeb 26, 2008
  19. Jeff KingFeb 26, 2008
  20. Jeff KingFeb 26, 2008
  21. Brandon CaseyFeb 26, 2008
  22. Jeff KingFeb 26, 2008

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.