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

From: Junio C Hamano <junkio@cox.net>
Date: 2006-10-31 16:11:25
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> It is trivial to do now,...

May be, but can we do something about these duplicated code?

> @@ -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));
> +}
> +


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Tue Oct 31 16:11:57 2006

This archive was generated by hypermail 2.1.8 : 2006-10-31 16:12:56 EST