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

Re: [PATCH v2] specifying ranges: we did not mean to make ".." an empty set

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
May 3, 2011, 06:39 UTC
Message-ID
<4DBFA31E.40207@drmicha.warpmail.net>
In-Reply-To
<20110502210141.GA15753@sigill.intra.peff.net>
Jeff King venit, vidit, dixit 02.05.2011 23:01:
Show 20 quoted lines
> On Mon, May 02, 2011 at 01:56:51PM -0700, Junio C Hamano wrote:
> 
>> Either end of revision range operator can be omitted to default to HEAD,
>> as in "origin.." (what did I do since I forked) or "..origin" (what did
>> they do since I forked).  But the current parser interprets ".."  as an
>> empty range "HEAD..HEAD", and worse yet, because ".." does exist on the
>> filesystem, we get this annoying output:
>>
>>   $ cd Documentation/howto
>>   $ git log .. ;# give me recent commits that touch Documentation/ area.
>>   fatal: ambiguous argument '..': both revision and filename
>>   Use '--' to separate filenames from revisions
>>
>> Surely we could say "git log ../" or even "git log -- .." to disambiguate,
>> but we shouldn't have to.
>>
>> Helped-by: Jeff King <peff@peff.net>
>> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> 
> Looks good to me.
I'm sorry but I don't like this at all, because:
Show 5 quoted lines
> Doing "..." is still allowed, but will never produce any useful results.
> I don't know if it is worth disallowing it to catch errors. I am tempted
> to say it should be magic for "@{u}...HEAD", but I think just "..." is
> getting unreadably magical. "@{u}...HEAD" is already pretty concise and
> is much more readable.

We need to disambiguate any pathspec with "--" which could be a revision parameter. Therefore I find it very unnatural to disambiguate ".." to a pathspec automatically (and have "..." error out). "../" is really simple enough to type.

For "..", we should either catch the error or, better, have ".." default to "@{u}..HEAD" and do the same for "...". Those are used much more often, and this goes with "try to parse as a rev first, then pathspec".

Michael
Previous: Junio C HamanoNext: Junio C Hamano
Message 9 of 19 in “[Annoyance] "git log .." thinks ".." is ambiguous”
  1. Junio C HamanoMay 2, 2011
  2. Jeff KingMay 2, 2011
  3. Jeff KingMay 2, 2011
  4. Junio C HamanoMay 2, 2011
  5. Jeff KingMay 2, 2011
  6. specifying ranges: we did not mean to make ".." an empty setJunio C Hamano, May 2, 2011
  7. Jeff KingMay 2, 2011
  8. Junio C HamanoMay 2, 2011
  9. Michael J GruberMay 3, 2011
  10. Junio C HamanoMay 3, 2011
  11. Michael J GruberMay 4, 2011
  12. Junio C HamanoMay 4, 2011
  13. Junio C HamanoMay 4, 2011
  14. Joshua JuranMay 3, 2011
  15. Michael J GruberMay 3, 2011
  16. Joshua JuranMay 3, 2011
  17. Michael J GruberMay 3, 2011
  18. Junio C HamanoMay 3, 2011
  19. John SzakmeisterMay 3, 2011

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.