From: Junio C Hamano Date: Sat, 30 Jan 2010 07:36:13 +0000 (-0800) Subject: Merge branch 'maint-1.6.5' into maint X-Git-Tag: v1.7.0-rc1~5^2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/3325cea0f7ef7355f6806b2fc88acdb2e27785ac?ds=inline;hp=-c Merge branch 'maint-1.6.5' into maint * maint-1.6.5: fix memcpy of overlapping area --- 3325cea0f7ef7355f6806b2fc88acdb2e27785ac diff --combined commit.c index 632061c2c3,a51d2cd1be..731191e63b --- a/commit.c +++ b/commit.c @@@ -5,7 -5,6 +5,7 @@@ #include "utf8.h" #include "diff.h" #include "revision.h" +#include "notes.h" int save_commit_buffer = 1; @@@ -200,7 -199,7 +200,7 @@@ struct commit_graft *lookup_commit_graf 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++) @@@ -209,10 -208,12 +209,10 @@@ 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_str_in_full(fd, "\n") != 1) - break; + strbuf_addstr(out, hex); + strbuf_addch(out, '\n'); } } return count; @@@ -224,7 -225,7 +224,7 @@@ int unregister_shallow(const unsigned c if (pos < 0) return -1; if (pos + 1 < commit_graft_nr) - memcpy(commit_graft + pos, commit_graft + pos + 1, + memmove(commit_graft + pos, commit_graft + pos + 1, sizeof(struct commit_graft *) * (commit_graft_nr - pos - 1)); commit_graft_nr--;