summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-03-23 21:55:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-03-23 21:55:37 (GMT)
commit6fe519a91cc7131931ca50fedcdeb8e41453c892 (patch)
tree42cc1a15b0bdb535713a2296192b9f9eaf0b4d63
parent7d0cf357a31cc8a442342696788d776265482ce9 (diff)
parent6eaf92f3d08180da4a6bd40035919a7e07ffed5a (diff)
downloadgit-6fe519a91cc7131931ca50fedcdeb8e41453c892.zip
git-6fe519a91cc7131931ca50fedcdeb8e41453c892.tar.gz
git-6fe519a91cc7131931ca50fedcdeb8e41453c892.tar.bz2
Merge branch 'pk/stash-apply-status-relative'
* pk/stash-apply-status-relative: Add test: git stash shows status relative to current dir git stash: show status relative to current directory
-rwxr-xr-xgit-stash.sh3
-rwxr-xr-xt/t3903-stash.sh19
2 files changed, 21 insertions, 1 deletions
diff --git a/git-stash.sh b/git-stash.sh
index 5130228..a305fb1 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -12,6 +12,7 @@ USAGE="list [<options>]
SUBDIRECTORY_OK=Yes
OPTIONS_SPEC=
+START_DIR=`pwd`
. git-sh-setup
require_work_tree
cd_to_toplevel
@@ -393,7 +394,7 @@ apply_stash () {
then
squelch='>/dev/null 2>&1'
fi
- eval "git status $squelch" || :
+ (cd "$START_DIR" && eval "git status $squelch") || :
else
# Merge conflict; keep the exit status from merge-recursive
status=$?
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 6fd560c..f62aaf5 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -556,4 +556,23 @@ test_expect_success 'stash branch should not drop the stash if the branch exists
git rev-parse stash@{0} --
'
+test_expect_success 'stash apply shows status same as git status (relative to current directory)' '
+ git stash clear &&
+ echo 1 >subdir/subfile1 &&
+ echo 2 >subdir/subfile2 &&
+ git add subdir/subfile1 &&
+ git commit -m subdir &&
+ (
+ cd subdir &&
+ echo x >subfile1 &&
+ echo x >../file &&
+ git status >../expect &&
+ git stash &&
+ sane_unset GIT_MERGE_VERBOSITY &&
+ git stash apply
+ ) |
+ sed -e 1,2d >actual && # drop "Saved..." and "HEAD is now..."
+ test_cmp expect actual
+'
+
test_done