projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
We do not like "HEAD" as a new branch name
[git.git]
/
git-checkout.sh
diff --git
a/git-checkout.sh
b/git-checkout.sh
index
73652fa
..
f241d4b
100755
(executable)
--- a/
git-checkout.sh
+++ b/
git-checkout.sh
@@
-1,5
+1,7
@@
#!/bin/sh
#!/bin/sh
-. git-sh-setup || die "Not a git archive"
+
+USAGE='[-f] [-b <new_branch>] [<branch>] [<paths>...]'
+. git-sh-setup
old=$(git-rev-parse HEAD)
new=
old=$(git-rev-parse HEAD)
new=
@@
-26,6
+28,9
@@
while [ "$#" != "0" ]; do
--)
break
;;
--)
break
;;
+ -*)
+ usage
+ ;;
*)
if rev=$(git-rev-parse --verify "$arg^0" 2>/dev/null)
then
*)
if rev=$(git-rev-parse --verify "$arg^0" 2>/dev/null)
then
@@
-75,7
+80,6
@@
then
# rescuing paths and is never meant to remove what
# is not in the named tree-ish.
git-ls-tree -r "$new" "$@" |
# rescuing paths and is never meant to remove what
# is not in the named tree-ish.
git-ls-tree -r "$new" "$@" |
- sed -ne 's/^\([0-7]*\) blob \(.*\)$/\1 \2/p' |
git-update-index --index-info || exit $?
fi
git-checkout-index -f -u -- "$@"
git-update-index --index-info || exit $?
fi
git-checkout-index -f -u -- "$@"
@@
-119,7
+123,9
@@
fi
#
if [ "$?" -eq 0 ]; then
if [ "$newbranch" ]; then
#
if [ "$?" -eq 0 ]; then
if [ "$newbranch" ]; then
- echo $new > "$GIT_DIR/refs/heads/$newbranch"
+ leading=`expr "refs/heads/$newbranch" : '\(.*\)/'` &&
+ mkdir -p "$GIT_DIR/$leading" &&
+ echo $new >"$GIT_DIR/refs/heads/$newbranch" || exit
branch="$newbranch"
fi
[ "$branch" ] &&
branch="$newbranch"
fi
[ "$branch" ] &&