summaryrefslogtreecommitdiff
path: root/shallow.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2013-08-16 09:52:03 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-08-28 18:51:17 (GMT)
commit6a3bbb4db409c5417960ffd3f020f75e0cb36f81 (patch)
tree0b2513653866fe9449b53b207ea1ba17e3c1ac43 /shallow.c
parent3125fe528b65c1e4a4f5f934d056af342ab5472d (diff)
downloadgit-6a3bbb4db409c5417960ffd3f020f75e0cb36f81.zip
git-6a3bbb4db409c5417960ffd3f020f75e0cb36f81.tar.gz
git-6a3bbb4db409c5417960ffd3f020f75e0cb36f81.tar.bz2
shallow: only add shallow graft points to new shallow file
for_each_commit_graft() goes through all graft points, and shallow boundaries are just one special kind of grafting. If $GIT_DIR/shallow and $GIT_DIR/info/grafts are both present, write_shallow_commits() may catch both sets, accidentally turning some graft points to shallow boundaries. Don't do that. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'shallow.c')
-rw-r--r--shallow.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/shallow.c b/shallow.c
index 68dd106..5f626c0 100644
--- a/shallow.c
+++ b/shallow.c
@@ -153,6 +153,8 @@ static int write_one_shallow(const struct commit_graft *graft, void *cb_data)
{
struct write_shallow_data *data = cb_data;
const char *hex = sha1_to_hex(graft->sha1);
+ if (graft->nr_parent != -1)
+ return 0;
data->count++;
if (data->use_pack_protocol)
packet_buf_write(data->out, "shallow %s", hex);