scan reflogs independently from refs
[gitweb.git] / git-checkout.sh
index 8500f51ea27054d328be6e7e53c9f14d0d9c1979..1349e77f32157cc63fba6644ae2112c21ec5264e 100755 (executable)
@@ -250,7 +250,7 @@ if [ "$?" -eq 0 ]; then
        fi
        if test -n "$branch"
        then
-               GIT_DIR="$GIT_DIR" git-symbolic-ref HEAD "refs/heads/$branch"
+               GIT_DIR="$GIT_DIR" git-symbolic-ref -m "checkout: moving to $branch" HEAD "refs/heads/$branch"
        elif test -n "$detached"
        then
                # NEEDSWORK: we would want a command to detach the HEAD
@@ -259,8 +259,9 @@ if [ "$?" -eq 0 ]; then
                #       git update-ref --detach HEAD $new
                # or something like that...
                #
-               echo "$detached" >"$GIT_DIR/HEAD.new" &&
-               mv "$GIT_DIR/HEAD.new" "$GIT_DIR/HEAD" ||
+               git-rev-parse HEAD >"$GIT_DIR/HEAD.new" &&
+               mv "$GIT_DIR/HEAD.new" "$GIT_DIR/HEAD" &&
+               git-update-ref -m "checkout: moving to $arg" HEAD "$detached" ||
                        die "Cannot detach HEAD"
                if test -n "$detach_warn"
                then