Code

Fix tests with new git in C
[git.git] / git-checkout.sh
index cb33fdc7e20272a77d97d1b68c31d9b93d3cf4d4..4c08f36b591508b5d940384db603e2f4483116d6 100755 (executable)
@@ -126,7 +126,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" ] &&