From: Junio C Hamano Date: Thu, 14 Dec 2006 08:40:15 +0000 (-0800) Subject: git-reset: make it work from within a subdirectory. X-Git-Tag: v1.5.0-rc0~108 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a81c311f23a5fadd6c1da38d46781644cd9db6e8;p=git.git git-reset: make it work from within a subdirectory. If you typically sit in, say "src/", it's annoying to have to change directory to do a reset. This may need to be reworked when we add "git reset -- paths..." to encapsulate the "ls-tree $tree | update-index --index-info" pattern. Signed-off-by: Junio C Hamano --- diff --git a/git-reset.sh b/git-reset.sh index c0feb4435..03d2c3b93 100755 --- a/git-reset.sh +++ b/git-reset.sh @@ -1,8 +1,15 @@ #!/bin/sh USAGE='[--mixed | --soft | --hard] []' +SUBDIRECTORY_OK=Yes . git-sh-setup +TOP=$(git-rev-parse --show-cdup) +if test ! -z "$TOP" +then + cd "$TOP" +fi + update= reset_type=--mixed case "$1" in