X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=git-reset.sh;h=fee6d98d9cba708828c36a2d2a29dbec8662c36b;hb=7a33b0bfced9cfcea785dac5ddf189d937a42446;hp=76c8a818d421c796141fae3835e1cb4726d23ef3;hpb=c326246accf36bc070b326773df2b9ec1c336037;p=git.git diff --git a/git-reset.sh b/git-reset.sh index 76c8a818d..fee6d98d9 100755 --- a/git-reset.sh +++ b/git-reset.sh @@ -6,6 +6,7 @@ USAGE='[--mixed | --soft | --hard] [] [ [--] ...]' SUBDIRECTORY_OK=Yes . git-sh-setup set_reflog_action "reset $*" +require_work_tree update= reset_type=--mixed unset rev @@ -42,7 +43,7 @@ case "$1" in --) shift ;; esac # affecting the working tree nor HEAD. if test $# != 0 then - test "$reset_type" == "--mixed" || + test "$reset_type" = "--mixed" || die "Cannot do partial $reset_type reset." git-diff-index --cached $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 }