X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=git-checkout.sh;h=4cf30e2c0529e90886e6edfd485cec67a278e224;hb=4e72dcec89c7cda7022d4ec2dd686e77deb5376e;hp=cb33fdc7e20272a77d97d1b68c31d9b93d3cf4d4;hpb=b0bafe0364860ba45b74a5aec5b920213d5caa34;p=git.git diff --git a/git-checkout.sh b/git-checkout.sh index cb33fdc7..4cf30e2c 100755 --- a/git-checkout.sh +++ b/git-checkout.sh @@ -1,5 +1,5 @@ #!/bin/sh -. git-sh-setup || die "Not a git archive" +. git-sh-setup usage () { die "usage: git checkout [-f] [-b ] [] [...]" @@ -82,7 +82,6 @@ then # 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 -- "$@" @@ -126,7 +125,9 @@ fi # 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" ] &&