aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/git-check-ref-format.txt
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-10-17 00:12:34 -0700
committerJunio C Hamano <gitster@pobox.com>2017-10-18 08:01:48 +0900
commit89dd32aedcb52a77240f3923a687edc8a61662e7 (patch)
tree99ebdc9614b4054a6d7d05321eeacb1804d52eee /Documentation/git-check-ref-format.txt
parent7ccc94ff4590cd035b7f78dfd9debbd7e692f3e6 (diff)
downloadgit-89dd32aedcb52a77240f3923a687edc8a61662e7.tar.gz
check-ref-format doc: --branch validates and expands <branch>
"git check-ref-format --branch $name" feature was originally introduced (and was advertised) as a way for scripts to take any end-user supplied string (like "master", "@{-1}" etc.) and see if it is usable when Git expects to see a branch name, and also obtain the concrete branch name that the at-mark magic expands to. Emphasize that "see if it is usable" role in the description and clarify that the @{...} expansion only occurs when run from within a repository. [jn: split out from a larger patch] Helped-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-check-ref-format.txt')
-rw-r--r--Documentation/git-check-ref-format.txt9
1 files changed, 8 insertions, 1 deletions
diff --git a/Documentation/git-check-ref-format.txt b/Documentation/git-check-ref-format.txt
index 92777cef25..cf0a0b7df2 100644
--- a/Documentation/git-check-ref-format.txt
+++ b/Documentation/git-check-ref-format.txt
@@ -77,7 +77,14 @@ reference name expressions (see linkgit:gitrevisions[7]):
. at-open-brace `@{` is used as a notation to access a reflog entry.
-With the `--branch` option, it expands the ``previous branch syntax''
+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