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

Re: [PATCH] fix pack.packSizeLimit and --max-pack-size handling

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 12, 2008, 21:23 UTC
Message-ID
<7vmyg4myf6.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<alpine.LFD.2.00.0811121255330.27509@xanadu.home>
Nicolas Pitre <nico@cam.org> writes:
Show 15 quoted lines
> @@ -2103,11 +2107,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
>  			continue;
>  		}
>  		if (!prefixcmp(arg, "--max-pack-size=")) {
> -			char *end;
> -			pack_size_limit_cfg = 0;
> -			pack_size_limit = strtoul(arg+16, &end, 0) * 1024 * 1024;
> -			if (!arg[16] || *end)
> +			if (!git_parse_ulong(arg+16, &pack_size_limit))
>  				usage(pack_usage);
> +			else
> +				pack_size_limit_cfg = 0;
>  			continue;
>  		}
>  		if (!prefixcmp(arg, "--window=")) {

Hmm, an unrelated funniness here is why the code even needs to futz with the value read from the configuration. Later in the code we have:

	if (!pack_to_stdout && !pack_size_limit)
		pack_size_limit = pack_size_limit_cfg;
and the intent seems to be:
 - if there is nothing on the command line, use config;
 - if there is something on the command line, ignore config.

But if you have a configured limit and would want to override from the command line, this won't work.

I will apply the wraparound avoidance as a separate "pure fix" patch to 'maint' first.

Besides, --max-pack-size has been defined as megabytes for the entirety of its existence, and I am a bit worried about changing the semantics at this point without any warning. I realize that I am worried too much for people with a script that give an explicit --max-pack-size=1 to obtain a set of split packs that would fit on floppies, who probably would not exist ;-)

Previous: Nicolas PitreNext: Nanako Shiraishi
Message 5 of 7 in “pack.packSizeLimit and --max-pack-size not working?”
  1. Jon NelsonNov 12, 2008
  2. fix pack.packSizeLimit and --max-pack-size handlingNicolas Pitre, Nov 12, 2008
  3. Junio C HamanoNov 12, 2008
  4. fix pack.packSizeLimit and --max-pack-size handlingNicolas Pitre, Nov 12, 2008
  5. Junio C HamanoNov 12, 2008
  6. Nanako ShiraishiNov 12, 2008
  7. Jon NelsonNov 12, 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.