public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Duy Nguyen <pclouds@gmail•com>
Cc: Git Mailing List <git@vger•kernel.org>
Subject: Re: [PATCH] checkout: swap the order of ambiguity check for :/ syntax
Date: Thu, 25 Aug 2016 10:19:40 -0700	[thread overview]
Message-ID: <xmqq60qoojf7.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <CACsJy8AnDoh-CZp8oa21YHcM3sxoTJZiK7fP+ecNyqd0-DBZAA@mail.gmail.com> (Duy Nguyen's message of "Thu, 25 Aug 2016 16:21:25 +0700")

Duy Nguyen <pclouds@gmail•com> writes:

> On Wed, Aug 24, 2016 at 11:35 PM, Junio C Hamano <gitster@pobox•com> wrote:
>> Nguyễn Thái Ngọc Duy  <pclouds@gmail•com> writes:
>>
>>> It's not wonderful, but it's in line with how git-checkout stops caring
>>> about ambiguity after the first argument can be resolved as a ref
>>> (there's even a test for it, t2010.6).
>>
>> But that is justifiable because checkout can only ever take one
>> revision.  What follows, if there are any, must be paths, and more
>> importantly, it would be perfectly reasonable if some of them were
>> missing in the working tree ("ow, I accidentally removed that file,
>> I need to resurrect it from the index").  Does the same justification
>> apply to this change?
>
> I think there is a misunderstanding. My "after" is in "after the first
> argument can be resolved, check if it exists in worktree too, if so
> it's ambiguous and bail". This is usually how we detect ambiguation.
> But git-checkout does not do the "check if it exists..." clause.

Hmph.  The "case 4" in the function you touched says

         * case 4: git checkout <something> <paths>
         *
         *   The first argument must not be ambiguous.
         *   - If it's *only* a reference, treat it like case (1).
         *   - If it's only a path, treat it like case (2).
         *   - else: fail.

Did we break it recently?

  reply	other threads:[~2016-08-25 17:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-22 12:35 [PATCH] checkout: swap the order of ambiguity check for :/ syntax Nguyễn Thái Ngọc Duy
2016-08-24 16:35 ` Junio C Hamano
2016-08-25  9:21   ` Duy Nguyen
2016-08-25 17:19     ` Junio C Hamano [this message]
2016-08-26 13:34       ` Duy Nguyen
2016-09-07 11:19 ` [PATCH 0/3] fix checkout ambiguation in subdir Nguyễn Thái Ngọc Duy
2016-09-07 11:19   ` [PATCH 1/3] checkout: add some spaces between code and comment Nguyễn Thái Ngọc Duy
2016-09-07 11:19   ` [PATCH 2/3] checkout.txt: document a common case that ignores ambiguation rules Nguyễn Thái Ngọc Duy
2016-09-08 20:03     ` Junio C Hamano
2016-09-09 19:21       ` Junio C Hamano
2016-09-07 11:19   ` [PATCH 3/3] checkout: fix ambiguity check in subdir Nguyễn Thái Ngọc Duy
2016-09-08 20:04     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq60qoojf7.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=pclouds@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox