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

Re: [PATCH] Add failing test for fetching from multiple packs over dumb httpd

From
Charles Bailey <charles@hashpling.org>
Date
Jan 27, 2015, 18:29 UTC
Message-ID
<20150127182939.GA18236@hashpling.org>
In-Reply-To
<20150127181220.GA17067@peff.net>
On Tue, Jan 27, 2015 at 01:12:21PM -0500, Jeff King wrote:
Show 9 quoted lines
> On Tue, Jan 27, 2015 at 03:20:41PM +0000, Charles Bailey wrote:
> 
> > From: Charles Bailey <cbailey32@bloomberg.net>
> > 
> > When objects are spread across multiple packs, if an initial fetch does
> > require all pack files, a subsequent fetch for objects in packs not
> > retrieved in the initial fetch will fail.
> 
> s/does/does not/, I think?
Yes, that's definitely what I meant to write.
[...]
Show 5 quoted lines
> It looks like the culprit is 7b64469 (Allow parse_pack_index on
> temporary files, 2010-04-19). It added a new "idx_path" parameter to
> parse_pack_index, which we pass as NULL.  That causes its call to
> check_packed_git_idx to fail (because it has no idea what file we are
> talking about!).

That change looks like it went into 1.7.1.1. I cannot confirm this working before then but we've definitely seen the bug in 1.7.12.3 and more recent versions.

Show 16 quoted lines
> This seems to fix it:
> 
> diff --git a/sha1_file.c b/sha1_file.c
> index 30995e6..eda4d90 100644
> --- a/sha1_file.c
> +++ b/sha1_file.c
> @@ -1149,6 +1149,9 @@ struct packed_git *parse_pack_index(unsigned char *sha1, const char *idx_path)
>  	const char *path = sha1_pack_name(sha1);
>  	struct packed_git *p = alloc_packed_git(strlen(path) + 1);
>  
> +	if (!idx_path)
> +		idx_path = sha1_pack_index_name(sha1);
> +
>  	strcpy(p->pack_name, path);
>  	hashcpy(p->sha1, sha1);
>  	if (check_packed_git_idx(idx_path, p)) {

It certainly fixes my test script and I can give this patch a test in the 'real' world.

Previous: Jeff KingNext: Jeff King
Message 3 of 6 in “Add failing test for fetching from multiple packs over dumb httpd”
  1. Add failing test for fetching from multiple packs over dumb httpdCharles Bailey, Jan 27, 2015
  2. Jeff KingJan 27, 2015
  3. Charles BaileyJan 27, 2015
  4. dumb-http: do not pass NULL path to parse_pack_indexJeff King, Jan 27, 2015
  5. Charles BaileyJan 27, 2015
  6. Junio C HamanoJan 27, 2015

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.