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

Re: [PATCH 1/5] upload-pack: no longer call rev-list

From
Junio C Hamano <junkio@cox.net>
Date
Oct 31, 2006, 05:11 UTC
Message-ID
<7v1woprrwi.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.63.0610302008320.26682@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> It is trivial to do now,...
May be, but can we do something about these duplicated code?
Show 38 quoted lines
> @@ -57,6 +60,40 @@ static ssize_t send_client_data(int fd,
>  	return safe_write(fd, data, sz);
>  }
>  
> +FILE *pack_pipe = NULL;
> +static void show_commit(struct commit *commit)
> +{
> +	if (commit->object.flags & BOUNDARY)
> +		fputc('-', pack_pipe);
> +	if (fputs(sha1_to_hex(commit->object.sha1), pack_pipe) < 0)
> +		die("broken output pipe");
> +	fputc('\n', pack_pipe);
> +	fflush(pack_pipe);
> +	free(commit->buffer);
> +	commit->buffer = NULL;
> +}
> +
> +static void show_object(struct object_array_entry *p)
> +{
> +	/* An object with name "foo\n0000000..." can be used to
> +	 * confuse downstream git-pack-objects very badly.
> +	 */
> +	const char *ep = strchr(p->name, '\n');
> +	if (ep) {
> +		fprintf(pack_pipe, "%s %.*s\n", sha1_to_hex(p->item->sha1),
> +		       (int) (ep - p->name),
> +		       p->name);
> +	}
> +	else
> +		fprintf(pack_pipe, "%s %s\n",
> +				sha1_to_hex(p->item->sha1), p->name);
> +}
> +
> +static void show_edge(struct commit *commit)
> +{
> +	fprintf(pack_pipe, "-%s\n", sha1_to_hex(commit->object.sha1));
> +}
> +
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 2 of 4 in “upload-pack: no longer call rev-list”
  1. 1/5 upload-pack: no longer call rev-listJohannes Schindelin, Oct 30, 2006
  2. Junio C HamanoOct 31, 2006
  3. Johannes SchindelinOct 31, 2006
  4. Johannes SchindelinOct 31, 2006

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.