cache.h; fix a couple of prototypes
[gitweb.git] / git-reset.sh
index 76c8a818d421c796141fae3835e1cb4726d23ef3..bf2a0581fe0b0dd2c393dce6f31c8e9ad9f352c9 100755 (executable)
@@ -6,6 +6,7 @@ USAGE='[--mixed | --soft | --hard]  [<commit-ish>] [ [--] <paths>...]'
 SUBDIRECTORY_OK=Yes
 . git-sh-setup
 set_reflog_action "reset $*"
+require_work_tree
 
 update= reset_type=--mixed
 unset rev
@@ -52,11 +53,7 @@ then
        exit
 fi
 
-TOP=$(git-rev-parse --show-cdup)
-if test ! -z "$TOP"
-then
-       cd "$TOP"
-fi
+cd_to_toplevel
 
 if test "$reset_type" = "--hard"
 then
@@ -90,7 +87,7 @@ update_ref_status=$?
 case "$reset_type" in
 --hard )
        test $update_ref_status = 0 && {
-               echo -n "HEAD is now at "
+               printf "HEAD is now at "
                GIT_PAGER= git log --max-count=1 --pretty=oneline \
                        --abbrev-commit HEAD
        }