Skip to content

Commit

Permalink
Merge branch 'pk/stash-apply-status-relative' into maint
Browse files Browse the repository at this point in the history
* pk/stash-apply-status-relative:
  Add test: git stash shows status relative to current dir
  git stash: show status relative to current directory
  • Loading branch information
Junio C Hamano committed Apr 1, 2011
2 parents bcf3d1f + 6eaf92f commit 2aa5b6b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion git-stash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ USAGE="list [<options>]

SUBDIRECTORY_OK=Yes
OPTIONS_SPEC=
START_DIR=`pwd`
. git-sh-setup
require_work_tree
cd_to_toplevel
Expand Down Expand Up @@ -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=$?
Expand Down
19 changes: 19 additions & 0 deletions t/t3903-stash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 2aa5b6b

Please sign in to comment.