[PATCH] checkout: allow full refnames for local branches
- From
- Lars Hjemli <hjemli@gmail.com>
- Date
- May 9, 2007, 08:40 UTC
- Message-ID
- <11787000032830-git-send-email-hjemli@gmail.com>
This teaches git-checkout to strip the prefix 'refs/heads/' from the supplied <branch> argument, to make
git-checkout refs/heads/master
behave like
git-checkout master
The former command would detach HEAD.
Signed-off-by: Lars Hjemli <hjemli@gmail.com> ---
I'm undecided on wheter this is a bugfix or a new feature. It certainly introduces new behaviour, but it passes all the tests.
git-checkout.sh | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/git-checkout.sh b/git-checkout.sh index ed7c2c5..6ff7b6e 100755 --- a/git-checkout.sh +++ b/git-checkout.sh @@ -63,6 +63,7 @@ while [ "$#" != "0" ]; do echo "unknown flag $arg" exit 1 fi + arg=$(echo "$arg" | sed -e "s|^refs/heads/||") new="$rev" new_name="$arg" if git-show-ref --verify --quiet -- "refs/heads/$arg"
-- 1.5.2.rc2.21.g3082a