aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgit-stash.sh1
-rwxr-xr-xt/t3903-stash.sh7
2 files changed, 8 insertions, 0 deletions
diff --git a/git-stash.sh b/git-stash.sh
index de13dd181..d9cd42d4b 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -6,6 +6,7 @@ USAGE='[ | list | show | apply | clear]'
SUBDIRECTORY_OK=Yes
. git-sh-setup
require_work_tree
+cd_to_toplevel
TMP="$GIT_DIR/.git-stash.$$"
trap 'rm -f "$TMP-*"' 0
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 392ac1c5c..9a9a250d2 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -66,4 +66,11 @@ test_expect_success 'apply stashed changes (including index)' '
test 1 = $(git show HEAD:file)
'
+test_expect_success 'unstashing in a subdirectory' '
+ git reset --hard HEAD &&
+ mkdir subdir &&
+ cd subdir &&
+ git stash apply
+'
+
test_done