git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] checkout: allow full refnames for local branches
@ 2007-05-09  8:40 Lars Hjemli
  2007-05-09  8:48 ` Junio C Hamano
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Hjemli @ 2007-05-09  8:40 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-05-09 20:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-09  8:40 [PATCH] checkout: allow full refnames for local branches Lars Hjemli
2007-05-09  8:48 ` Junio C Hamano
2007-05-09  9:07   ` Lars Hjemli
2007-05-09 18:54     ` Shawn O. Pearce
2007-05-09 20:01       ` Lars Hjemli
2007-05-09 20:11         ` Shawn O. Pearce
2007-05-09 20:38           ` Lars Hjemli
2007-05-09 19:37     ` Junio C Hamano
2007-05-09 19:55       ` Lars Hjemli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).