Re: Possible regression: overwriting untracked files in a fresh repo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> writes:

> diff --git a/builtin-checkout.c b/builtin-checkout.c
> index 8a9a474..1f2f84d 100644
> --- a/builtin-checkout.c
> +++ b/builtin-checkout.c
> @@ -402,7 +402,9 @@ static int merge_working_tree(struct checkout_opts *opts,
>  		topts.dir = xcalloc(1, sizeof(*topts.dir));
>  		topts.dir->flags |= DIR_SHOW_IGNORED;
>  		topts.dir->exclude_per_dir = ".gitignore";
> -		tree = parse_tree_indirect(old->commit->object.sha1);
> +		tree = parse_tree_indirect(old->commit ?
> +					   old->commit->object.sha1 :
> +					   (unsigned char *)EMPTY_TREE_SHA1_BIN);
>  		init_tree_desc(&trees[0], tree->buffer, tree->size);
>  		tree = parse_tree_indirect(new->commit->object.sha1);
>  		init_tree_desc(&trees[1], tree->buffer, tree->size);

This looks a lot saner; I like it.  Care to wrap it up with the usual
supporting material?

I think the "You appear to be" can just go, but I do not feel very
strongly either way.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]