Duy Nguyen <pclo...@gmail.com> 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to