Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/5] upload-pack: no longer call rev-list
Date: Mon, 30 Oct 2006 21:11:25 -0800	[thread overview]
Message-ID: <7v1woprrwi.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <Pine.LNX.4.63.0610302008320.26682@wbgn013.biozentrum.uni-wuerzburg.de> (Johannes Schindelin's message of "Mon, 30 Oct 2006 20:08:43 +0100 (CET)")

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


  reply	other threads:[~2006-10-31  5:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-30 19:08 [PATCH 1/5] upload-pack: no longer call rev-list Johannes Schindelin
2006-10-31  5:11 ` Junio C Hamano [this message]
2006-10-31  9:56   ` Johannes Schindelin
2006-10-31 10:02     ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v1woprrwi.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox