summaryrefslogtreecommitdiff
path: root/git-reset.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-12-14 00:40:15 -0800
committerJunio C Hamano <junkio@cox.net>2006-12-14 02:45:51 -0800
commita81c311f23a5fadd6c1da38d46781644cd9db6e8 (patch)
tree1fca073c4bce5daf1aef74b279fd74fa512a734f /git-reset.sh
parent4da9028578ffaaf8985e1436e2e1cf16bd3b9023 (diff)
downloadgit-a81c311f23a5fadd6c1da38d46781644cd9db6e8.tar.gz
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 <junkio@cox.net>
Diffstat (limited to 'git-reset.sh')
-rwxr-xr-xgit-reset.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/git-reset.sh b/git-reset.sh
index c0feb4435d..03d2c3b937 100755
--- a/git-reset.sh
+++ b/git-reset.sh
@@ -1,8 +1,15 @@
#!/bin/sh
USAGE='[--mixed | --soft | --hard] [<commit-ish>]'
+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