git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Suggestion: better error message when an ambiguous checkout is executed

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 12, 2017, 06:53 UTC
Message-ID
<xmqqo9qg1k82.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<xmqq8tivngkk.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 29 quoted lines
> Mahmoud Al-Qudsi <mqudsi@neosmart.net> writes:
>
>> The default git behavior when attempting to `git checkout xxx` for
>> some value of "xxx" that cannot be resolved to a single, unique
>> file/path/branch/tag/commit/etc is to display the following:
> ...
> So a possible implementation approach would be
>
>  - to let the current code do what it is doing
>
>  - except that you add new code immediately before the code that
>    issues 'xxx' did not match (i.e. the code already checked that
>    'xxx' taken as a pathspec does not match anything, and about to
>    give the error message but hasn't done so just yet).
>
>  - your new code 
>
>    . checks if 'xxx' could be an attempt to refer to a rev but
>      insufficiently spelled out (e.g. both origin[12]/xxx exists, or
>      for a bonus point, a similarly named origin/xxy exists and
>      could be a typo).
>
>    . if the above check found something, then you report it and
>      terminate without complaining "pathspec 'xxx' did not
>      match..."
>
>    . on the other hand, if the above check did not find anything,
>      then you let the current code issue the same error message as
>      before.

I was sweeping my mailbox to collect loose ends that haven't been tied down, and noticed that this topic does not seem to have reached a conclusion. Do we want to reboot the effort? Or should we just throw it in the #leftoverbits bin for now?

Thanks.
Previous: Junio C Hamano
Message 3 of 3 in “Suggestion: better error message when an ambiguous checkout is executed”
  1. Mahmoud Al-QudsiAug 7, 2017
  2. Junio C HamanoAug 7, 2017
  3. Junio C HamanoSep 12, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.