Re: [PATCH] checkout: don't check worktrees when not necessary

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

 



Duy Nguyen <pclouds@xxxxxxxxx> writes:
> On Sun, May 31, 2015 at 07:16:29PM -0400, Spencer Baugh wrote:
>> --- a/builtin/checkout.c
>> +++ b/builtin/checkout.c
>> @@ -1237,6 +1237,7 @@ static int parse_branchname_arg(int argc, const char **argv,
>>  		char *head_ref = resolve_refdup("HEAD", 0, sha1, &flag);
>>  		if (head_ref &&
>>  		    (!(flag & REF_ISSYMREF) || strcmp(head_ref, new->path)) &&
>> +		    !(opts->patch_mode || opts->pathspec.nr) &&
>>  		    !opts->ignore_other_worktrees)
>>  			check_linked_checkouts(new);
>>  		free(head_ref);
>
> Simple and effective. But if in future we add more options for
> non-switching-branch checkout, we need to update both places, here and
> near the end of cmd_checkout().
>
> Perhaps we can move all this block inside checkout_branch() so we only
> need to test "opts->patch_mode || opts->pathspec.nr" once, at the end
> of cmd_checkout(). Something like below?
>
> I'm not opposed to your change, but if you go with it, you should
> cherry pick my test in the below patch. Or create a similar test.

Sorry for late reply, but I think your change is much better than mine
so I'd suggest just using that instead.
--
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]