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

3 messages, 2 authors, 2016-08-11 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2016-08-11 20:25:56

Johannes Schindelin [off-list ref] writes:
It is trivial to do now,...
May be, but can we do something about these duplicated code?
quoted hunk
@@ -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));
+}
+

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

From: Johannes Schindelin <hidden>
Date: 2016-08-11 19:18:36

Hi,

On Tue, 31 Oct 2006, Johannes Schindelin wrote:
Except show_commit() should not show "commit " in front of each line. 
So, another parameter?
Sorry, that was not clear. When using traverse_commit_list() from 
upload-pack, the "commit " prefix is _not_ shown. With every other 
user of travsere_commit_list(), it is.

Ciao,
Dscho

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

From: Johannes Schindelin <hidden>
Date: 2016-08-11 20:23:28


On Mon, 30 Oct 2006, Junio C Hamano wrote:
Johannes Schindelin [off-list ref] writes:
quoted
It is trivial to do now,...
May be, but can we do something about these duplicated code?
quoted
@@ -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)
[...]
Yes, we could make mark_edges_uninteresting() and traverse_commit_list() 
take a FILE * parameter, which is then passed to the functions. Hmmm?

Except show_commit() should not show "commit " in front of each line. So, 
another parameter?

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help