shallow: only add shallow graft points to new shallow file
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Fri, 16 Aug 2013 09:52:03 +0000 (16:52 +0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 28 Aug 2013 18:51:17 +0000 (11:51 -0700)
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>
shallow.c
index 68dd10687b81d238ae9a5a99a61acf4e1396b668..5f626c013890b60c991200434589425a0e16cef9 100644 (file)
--- 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);