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

Re: [PATCH 0/4 v4] WIP: allow "-" as a shorthand for "previous branch"

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 16, 2017, 18:49 UTC
Message-ID
<xmqqinoax96u.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<vpqa89mnl4z.fsf@anie.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
Show 13 quoted lines
> Siddharth Kannan <kannan.siddharth12@gmail.com> writes:
>
>> This is as per our discussion[1]. The patches and commit messages are based on
>> Junio's patches that were posted as a reply to
>> <20170212184132.12375-1-gitster@pobox.com>.
>>
>> As per Matthieu's comments, I have updated the tests, but there is still one
>> thing that is not working: log -@{yesterday} or log -@{2.days.ago}
>
> Note that I did not request that these things work, just that they seem
> to be relevant tests: IMHO it's OK to reject them, but for example we
> don't want them to segfault. And having a test is a good hint that you
> thought about what could happen and to document it.

The branch we were on before would be a ref, and the ref may know where it was yesterday? If @{-1}@{1.day} works it would be natural to expect -@{1.day} to, too, but there probably is some disambiguity or other reasons that they cannot or should not work that way I am missing, in which case it is fine ("too much work for too obscure feature that is not expected to be used often" is also an acceptable reason) to punt or deliberately not support it, as long as it is explained in the log and/or doc (future developers need to know if we are simply punting, or if we found a case where it would hurt end user experience if we supported the feature), and as long as it does not do a wrong thing (dying with "we do not support it" is OK, segfaulting or doing random other things is not).

Thanks.
Previous: Matthieu MoyNext: Siddharth Kannan
Message 15 of 16 in “WIP: allow "-" as a shorthand for "previous branch"”
  1. 0/4 WIP: allow "-" as a shorthand for "previous branch"Siddharth Kannan, Feb 16, 2017
  2. 1/4 revision.c: do not update argv with unknown optionSiddharth Kannan, Feb 16, 2017
  3. Matthieu MoyFeb 16, 2017
  4. Junio C HamanoFeb 16, 2017
  5. Matthieu MoyFeb 16, 2017
  6. Siddharth KannanFeb 16, 2017
  7. 2/4 revision.c: swap if/else blocksSiddharth Kannan, Feb 16, 2017
  8. 3/4 revision.c: args starting with "-" might be a revisionSiddharth Kannan, Feb 16, 2017
  9. 4/4 sha1_name.c: teach get_sha1_1 "-" shorthand for "@{-1}"Siddharth Kannan, Feb 16, 2017
  10. Junio C HamanoFeb 16, 2017
  11. Siddharth KannanFeb 20, 2017
  12. Junio C HamanoFeb 20, 2017
  13. Siddharth KannanFeb 22, 2017
  14. Matthieu MoyFeb 16, 2017
  15. Junio C HamanoFeb 16, 2017
  16. Siddharth KannanFeb 16, 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.