Skip to content

Commit 6a3bbb4

Browse files
pcloudsgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3125fe5 commit 6a3bbb4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

shallow.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ static int write_one_shallow(const struct commit_graft *graft, void *cb_data)
153153
{
154154
struct write_shallow_data *data = cb_data;
155155
const char *hex = sha1_to_hex(graft->sha1);
156+
if (graft->nr_parent != -1)
157+
return 0;
156158
data->count++;
157159
if (data->use_pack_protocol)
158160
packet_buf_write(data->out, "shallow %s", hex);

0 commit comments

Comments
 (0)