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

Re: [PATCH] worktree: allow "-" short-hand for @{-1} in add command

From
Junio C Hamano <gitster@pobox.com>
Date
May 27, 2016, 18:01 UTC
Message-ID
<xmqqr3cnqt1g.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<9975E0C6-7BCC-4D80-BBC6-2C0BAB13D3E6@grenoble-inp.org>
Jordan DE GEA <jordan.de-gea@grenoble-inp.org> writes:
Show 8 quoted lines
>>> +test_expect_success '"add" using shorthand - fails when no previous branch' '
>>> +	test_must_fail git worktree add existing -
>>> +'
>> 
>> Just an observation, but the error message we would see here might
>> be interesting.
>
> Of course, that’s useful to be sure of the error, I will do in next preroll.

That was not what I meant. The exit status being non-zero is what we primarily care about. The exact phrasing of the error message is much less important and in general we shouldn't enforce "the error message must remain so" in the test.

If you observe the error message from this test, e.g. by running it with "-v", I suspect that you would see the message would complain about "@{-1}".

I just wanted to make sure that you saw it and thought about its ramifications.

It is perfectly fine by me (others might disagree, though) if your conclusion after thinking about it is "Even though the user may be surprised to get complaints for "@{-1}" that she never gave to the command (she gave "-"), because we clearly document that "-" is a mere synonym/short-hand for @{-1}, it is OK". I still want to see that behaviour justified in the proposed commit log message.

And that is why I said it "might be interesting".
Previous: Jordan DE GEA
Message 7 of 7 in “worktree: allow "-" short-hand for @{-1} in add command”
  1. worktree: allow "-" short-hand for @{-1} in add commandJordan DE GEA, May 26, 2016
  2. Junio C HamanoMay 26, 2016
  3. Matthieu MoyMay 27, 2016
  4. Junio C HamanoMay 27, 2016
  5. Jordan DE GEAMay 27, 2016
  6. worktree: allow "-" short-hand for @{-1} in add commandJordan DE GEA, May 27, 2016
  7. Junio C HamanoMay 27, 2016

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.