remote.c: refactor match_explicit_refs()
[gitweb.git] / git-checkout.sh
index d561c88dcbd3d5a67b4b6725e00683e613d80b9b..33f1e87c0c209b89eb785381db62d826818b602d 100755 (executable)
@@ -63,12 +63,13 @@ while [ "$#" != "0" ]; do
                                echo "unknown flag $arg"
                                exit 1
                        fi
-                       new="$rev"
                        new_name="$arg"
                        if git-show-ref --verify --quiet -- "refs/heads/$arg"
                        then
+                               rev=$(git-rev-parse --verify "refs/heads/$arg^0")
                                branch="$arg"
                        fi
+                       new="$rev"
                elif rev=$(git-rev-parse --verify "$arg^{tree}" 2>/dev/null)
                then
                        # checking out selected paths from a tree-ish.