From: Junio C Hamano Date: Sat, 31 Oct 2009 03:07:33 +0000 (-0700) Subject: Merge branch 'jn/show-normalized-refs' X-Git-Tag: v1.6.6-rc0~79 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/68d00fd83421a0494c66512e4c66829f4863693d Merge branch 'jn/show-normalized-refs' * jn/show-normalized-refs: check-ref-format: simplify --print implementation git check-ref-format --print Add tests for git check-ref-format Conflicts: Documentation/git-check-ref-format.txt --- 68d00fd83421a0494c66512e4c66829f4863693d diff --cc Documentation/git-check-ref-format.txt index e9b3b40af4,211ae1c3fa..0aeef24780 --- a/Documentation/git-check-ref-format.txt +++ b/Documentation/git-check-ref-format.txt @@@ -9,7 -9,8 +9,8 @@@ SYNOPSI -------- [verse] 'git check-ref-format' + 'git check-ref-format' --print -'git check-ref-format' [--branch] +'git check-ref-format' --branch DESCRIPTION ----------- @@@ -63,19 -64,28 +64,31 @@@ reference name expressions (see linkgit . 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. +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. - 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 ---