diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-10-12 16:39:43 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-10-12 16:39:59 -0700 |
commit | 38eedc634bc5d30e8a7a2356d9eb3ae95d9b1d75 (patch) | |
tree | 4ed08365e305beb2dc7a2e7344124cdfeee69d2a /Documentation/git-check-ref-format.txt | |
parent | 58a05c74e7a9341af80eb98731d6b0dafe1b5c29 (diff) | |
download | git-38eedc634bc5d30e8a7a2356d9eb3ae95d9b1d75.tar.gz |
git check-ref-format --print
Tolerating empty path components in ref names means each ref does
not have a unique name. This creates difficulty for porcelains
that want to see if two branches are equal. Add a helper associating
to each ref a canonical name.
If a user asks a porcelain to create a ref "refs/heads//master",
the porcelain can run "git check-ref-format --print refs/heads//master"
and only deal with "refs/heads/master" from then on.
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.txt | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/Documentation/git-check-ref-format.txt b/Documentation/git-check-ref-format.txt index 0b7982ea76..211ae1c3fa 100644 --- a/Documentation/git-check-ref-format.txt +++ b/Documentation/git-check-ref-format.txt @@ -9,6 +9,7 @@ SYNOPSIS -------- [verse] 'git check-ref-format' <refname> +'git check-ref-format' --print <refname> 'git check-ref-format' [--branch] <branchname-shorthand> DESCRIPTION @@ -63,16 +64,28 @@ reference name expressions (see linkgit:git-rev-parse[1]): . 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 a branch name shorthand and prints the name of the branch the shorthand refers to. -EXAMPLE -------- - -git check-ref-format --branch @{-1}:: - -Print the name of the previous branch. +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 --- |