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

Re: [PATCH] fix sha1_pack_index_name()

From
Gustaf Hendeby <hendeby@isy.liu.se>
Date
May 28, 2008, 16:59 UTC
Message-ID
<483D8F63.2000007@isy.liu.se>
In-Reply-To
<7vskw2v0i8.fsf_-_@gitster.siamese.dyndns.org>
On 05/28/2008 06:47 PM, Junio C Hamano wrote:
Show 8 quoted lines
> An earlier commit 633f43e (Remove redundant code, eliminate one static
> variable, 2008-05-24) had a thinko (perhaps an eyeno) that broke
> sha1_pack_index_name() function.  One symptom of this was that the http
> walker is now completely broken.
> 
> This should fix it.
> 
> Signed-off-by: Junio C Hamano <gitster@pobox.com>

This did - applied on top of next - not fix my problem but changed the error message somewhat:

$ git version git version 1.5.6.rc0.141.g55e0e $ git fetch origin Getting alternates list for http://repo.or.cz/r/git-homepage.git Getting pack list for http://repo.or.cz/r/git-homepage.git error: Unable to find 50819d376acb03429ab2628ef3d07893c7f0e22c under http://repo.or.cz/r/git-homepage.git Cannot obtain needed object 50819d376acb03429ab2628ef3d07893c7f0e22c fatal: Fetch failed.

/Gustaf
Show 44 quoted lines
> ---
>  sha1_file.c |    9 +++++----
>  1 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/sha1_file.c b/sha1_file.c
> index 9679040..adcf37c 100644
> --- a/sha1_file.c
> +++ b/sha1_file.c
> @@ -177,7 +177,7 @@ char *sha1_file_name(const unsigned char *sha1)
>  }
>  
>  static char *sha1_get_pack_name(const unsigned char *sha1,
> -				char **name, char **base)
> +				char **name, char **base, const char *which)
>  {
>  	static const char hex[] = "0123456789abcdef";
>  	char *buf;
> @@ -187,7 +187,8 @@ static char *sha1_get_pack_name(const unsigned char *sha1,
>  		const char *sha1_file_directory = get_object_directory();
>  		int len = strlen(sha1_file_directory);
>  		*base = xmalloc(len + 60);
> -		sprintf(*base, "%s/pack/pack-1234567890123456789012345678901234567890.pack", sha1_file_directory);
> +		sprintf(*base, "%s/pack/pack-1234567890123456789012345678901234567890.%s",
> +			sha1_file_directory, which);
>  		*name = *base + len + 11;
>  	}
>  
> @@ -206,14 +207,14 @@ char *sha1_pack_name(const unsigned char *sha1)
>  {
>  	static char *name, *base;
>  
> -	return sha1_get_pack_name(sha1, &name, &base);
> +	return sha1_get_pack_name(sha1, &name, &base, "pack");
>  }
>  
>  char *sha1_pack_index_name(const unsigned char *sha1)
>  {
>  	static char *name, *base;
>  
> -	return sha1_get_pack_name(sha1, &name, &base);
> +	return sha1_get_pack_name(sha1, &name, &base, "idx");
>  }
>  
>  struct alternate_object_database *alt_odb_list;
Previous: Junio C Hamano
Message 4 of 4 in “Problem fetching the git homepage”
  1. Gustaf HendebyMay 28, 2008
  2. Junio C HamanoMay 28, 2008
  3. fix sha1_pack_index_name()Junio C Hamano, May 28, 2008
  4. Gustaf HendebyMay 28, 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.