X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=Documentation%2Fgit-check-ref-format.txt;h=0aeef24780f07e5d5fa021f6ebdaa7090a3dcdb7;hb=1b52ac5935c3773596fa41f6cf83578ab86b6b83;hp=171b68377d6604167fde4f5e4266432fa9048345;hpb=e72263a1f88d39a7e3672bbe15a7524f8a3f520a;p=git.git diff --git a/Documentation/git-check-ref-format.txt b/Documentation/git-check-ref-format.txt index 171b68377..0aeef2478 100644 --- a/Documentation/git-check-ref-format.txt +++ b/Documentation/git-check-ref-format.txt @@ -7,7 +7,10 @@ git-check-ref-format - Ensures that a reference name is well formed SYNOPSIS -------- +[verse] 'git check-ref-format' +'git check-ref-format' --print +'git check-ref-format' --branch DESCRIPTION ----------- @@ -23,6 +26,10 @@ imposes the following rules on how references are named: grouping, but no slash-separated component can begin with a dot `.`. +. They must contain at least one `/`. This enforces the presence of a + category like `heads/`, `tags/` etc. but the actual names are not + restricted. + . They cannot have two consecutive dots `..` anywhere. . They cannot have ASCII control characters (i.e. bytes whose @@ -30,7 +37,13 @@ imposes the following rules on how references are named: caret `{caret}`, colon `:`, question-mark `?`, asterisk `*`, or open bracket `[` anywhere. -. They cannot end with a slash `/`. +. They cannot end with a slash `/` nor a dot `.`. + +. They cannot end with the sequence `.lock`. + +. They cannot contain a sequence `@{`. + +- They cannot contain a `\\`. These rules make it easy for shell script based tools to parse reference names, pathname expansion by the shell when a reference name is used @@ -49,6 +62,33 @@ reference name expressions (see linkgit:git-rev-parse[1]): It may also be used to select a specific object such as with 'git-cat-file': "git cat-file blob v1.3.3:refs.c". +. at-open-brace `@{` is used as a notation to access a reflog entry. + +With the `--print` option, if 'refname' is acceptable, it prints the +canonicalized name of a hypothetical reference with that name. That is, +it prints 'refname' with any extra `/` characters removed. + +With the `--branch` option, it expands 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. + +EXAMPLES +-------- + +* Print the name of the previous branch: ++ +------------ +$ git check-ref-format --branch @{-1} +------------ + +* Determine the reference name to use for a new branch: ++ +------------ +$ ref=$(git check-ref-format --print "refs/heads/$newbranch") || +die "we do not like '$newbranch' as a branch name." +------------ GIT ---