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

Re: [PATCH v2] branch -D: allow - as abbreviation of '@{-1}'

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 22, 2016, 17:12 UTC
Message-ID
<xmqqwpouigin.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<xmqq1t72jvac.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
> I _think_ strbuf_branchname() leaves "@{-<N>}" when you do not have
> enough branch switches in the reflog, so perhaps ...

This is a tangent, but the value returned from strbuf_branchname() is not well documented, and nobody looks at it. It might not be a bad idea to change the return value from the function in such a way that it can signal "I saw @{-<N>} syntax but there weren't enough branch switches" and also "I saw branch@{upstream} syntax but that branch does not have an upstream configured for it" to its callers.

That way, the suggested "perhaps like this..." patch does not have to do an ugly hack: if (starts_with(bname.buf, "@{-")).

Previous: Junio C HamanoNext: Eric Sunshine
Message 4 of 6 in “branch -D: allow - as abbreviation of '@{-1}'”
  1. branch -D: allow - as abbreviation of '@{-1}'Elena Petrashen, Mar 22, 2016
  2. Matthieu MoyMar 22, 2016
  3. Junio C HamanoMar 22, 2016
  4. Junio C HamanoMar 22, 2016
  5. Eric SunshineMar 22, 2016
  6. elena petrashenMar 24, 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.