Johannes Schindelin <Johannes.Schindelin@xxxxxx> 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@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html