X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=commit.c;h=471efb0566368aaf589d6d8390d583bc21bed256;hb=7da4e2280ccaf5ecb357f7cb2b81d62f78f00f9e;hp=a6c6f70a9237385d163ea12ef28e5087e9f80411;hpb=42fa6df99fe1f0439244893e81efad0cc4524c3d;p=git.git diff --git a/commit.c b/commit.c index a6c6f70a9..471efb056 100644 --- a/commit.c +++ b/commit.c @@ -199,7 +199,7 @@ struct commit_graft *lookup_commit_graft(const unsigned char *sha1) return commit_graft[pos]; } -int write_shallow_commits(int fd, int use_pack_protocol) +int write_shallow_commits(struct strbuf *out, int use_pack_protocol) { int i, count = 0; for (i = 0; i < commit_graft_nr; i++) @@ -208,12 +208,10 @@ int write_shallow_commits(int fd, int use_pack_protocol) sha1_to_hex(commit_graft[i]->sha1); count++; if (use_pack_protocol) - packet_write(fd, "shallow %s", hex); + packet_buf_write(out, "shallow %s", hex); else { - if (write_in_full(fd, hex, 40) != 40) - break; - if (write_in_full(fd, "\n", 1) != 1) - break; + strbuf_addstr(out, hex); + strbuf_addch(out, '\n'); } } return count;