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

Re: [PATCH v4 2/2] Doc/check-ref-format: clarify information about @{-N} syntax

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 14, 2017, 18:02 UTC
Message-ID
<xmqqa7ylur1i.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20171214123027.9105-1-kaartic.sivaraam@gmail.com>
Kaartic Sivaraam <kaartic.sivaraam@gmail.com> writes:
Show 27 quoted lines
>  With the `--branch` option, the command takes a name and checks if
> -it can be used as a valid branch name (e.g. when creating a new
> -branch).  The rule `git check-ref-format --branch $name` implements
> -may be stricter than what `git check-ref-format refs/heads/$name`
> -says (e.g. a dash may appear at the beginning of a ref component,
> -but it is explicitly forbidden at the beginning of a branch name).
> -When run with `--branch` option in a repository, the input is first
> -expanded for the ``previous branch syntax''
> -`@{-n}`.  For example, `@{-1}` is a way to refer the last branch you
> -were on.  This option should be used by porcelains to accept this
> -syntax anywhere a branch name is expected, so they can act as if you
> -typed the branch name.
> +it can be used as a valid branch name e.g. when creating a new branch
> +(but be cautious when using the previous checkout syntax; it may refer
> +to a detached HEAD state). The rule `git check-ref-format --branch
> +$name` implements may be stricter than what `git check-ref-format
> +refs/heads/$name` says (e.g. a dash may appear at the beginning of a
> +ref component, but it is explicitly forbidden at the beginning of a
> +branch name). When run with `--branch` option in a repository, the
> +input is first expanded for the ``previous checkout syntax''
> +`@{-n}`.  For example, `@{-1}` is a way to refer the last thing that
> +was checked out using "git checkout" operation. This option should be
> +used by porcelains to accept this syntax anywhere a branch name is
> +expected, so they can act as if you typed the branch name. As an
> +exception note that, the ``previous checkout operation'' might result
> +in a commit object name when the N-th last thing checked out was not
> +a branch.
Looks alright.  

It was made unnecessarily harder to review because it was marked as 2/2, even though this no longer applies on top of the copy of 1/2 that was merged some time ago. I needed to find that it was rebased on top of 'master'; it wouldn't have been necessary if this was sent as a single patch (with comment saying that this used to be 2/2 whose first one already graduated to 'master' under the three-dash line).

Also re-wrapping the lines only to squeeze in "but be cautious..." and replace s/branch/checkout/ in a few places did not help to make it easy to spot what's changed.

This part looked a bit strange.
> +it can be used as a valid branch name e.g. when creating a new branch
> +(but be cautious when using the previous checkout syntax; it may refer
> +to a detached HEAD state). The rule `git check-ref-format --branch

I think "e.g. when creating a new branch" is a parenthetical remark, so it should be inside parenthesis. As the last three lines in the new text (quoted above) already warns that it may not be a branch name, I am not sure if the "but be cautious" adds much value, though.

Previous: Kaartic SivaraamNext: Kaartic Sivaraam
Message 16 of 20 in “docs: checking out using @{-N} can lead to detached state”
  1. docs: checking out using @{-N} can lead to detached stateKaartic Sivaraam, Nov 19, 2017
  2. Junio C HamanoNov 20, 2017
  3. Kaartic SivaraamNov 20, 2017
  4. 1/2 Doc/checkout: checking out using @{-N} can lead to detached stateKaartic Sivaraam, Nov 27, 2017
  5. 2/2 Doc/check-ref-format: clarify information about @{-N} syntaxKaartic Sivaraam, Nov 27, 2017
  6. Junio C HamanoNov 28, 2017
  7. Kaartic SivaraamNov 28, 2017
  8. Junio C HamanoDec 3, 2017
  9. Kaartic SivaraamDec 4, 2017
  10. Junio C HamanoDec 4, 2017
  11. Kaartic SivaraamDec 5, 2017
  12. 2/2 Doc/check-ref-format: clarify information about @{-N} syntaxKaartic Sivaraam, Nov 28, 2017
  13. Junio C HamanoDec 3, 2017
  14. Kaartic SivaraamDec 6, 2017
  15. 2/2 Doc/check-ref-format: clarify information about @{-N} syntaxKaartic Sivaraam, Dec 14, 2017
  16. Junio C HamanoDec 14, 2017
  17. Kaartic SivaraamDec 16, 2017
  18. 0/1 clarify about @{-N} syntax in check-ref-format documentationKaartic Sivaraam, Dec 16, 2017
  19. 1/1 Doc/check-ref-format: clarify information about @{-N} syntaxKaartic Sivaraam, Dec 16, 2017
  20. Junio C HamanoNov 28, 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.