mirror of
https://github.com/git/git
synced 2024-09-17 23:41:33 +00:00
Teach "git checkout" to use git-show-ref
That way, it doesn't care how the refs are stored any more Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
358ddb62cf
commit
305e22c36e
|
@ -22,7 +22,7 @@ while [ "$#" != "0" ]; do
|
||||||
shift
|
shift
|
||||||
[ -z "$newbranch" ] &&
|
[ -z "$newbranch" ] &&
|
||||||
die "git checkout: -b needs a branch name"
|
die "git checkout: -b needs a branch name"
|
||||||
[ -e "$GIT_DIR/refs/heads/$newbranch" ] &&
|
git-show-ref --verify --quiet -- "refs/heads/$newbranch" &&
|
||||||
die "git checkout: branch $newbranch already exists"
|
die "git checkout: branch $newbranch already exists"
|
||||||
git-check-ref-format "heads/$newbranch" ||
|
git-check-ref-format "heads/$newbranch" ||
|
||||||
die "git checkout: we do not like '$newbranch' as a branch name."
|
die "git checkout: we do not like '$newbranch' as a branch name."
|
||||||
|
@ -51,7 +51,8 @@ while [ "$#" != "0" ]; do
|
||||||
fi
|
fi
|
||||||
new="$rev"
|
new="$rev"
|
||||||
new_name="$arg^0"
|
new_name="$arg^0"
|
||||||
if [ -f "$GIT_DIR/refs/heads/$arg" ]; then
|
if git-show-ref --verify --quiet -- "refs/heads/$arg"
|
||||||
|
then
|
||||||
branch="$arg"
|
branch="$arg"
|
||||||
fi
|
fi
|
||||||
elif rev=$(git-rev-parse --verify "$arg^{tree}" 2>/dev/null)
|
elif rev=$(git-rev-parse --verify "$arg^{tree}" 2>/dev/null)
|
||||||
|
|
Loading…
Reference in a new issue