Skip to content

Commit

Permalink
Make sure git-stash works from subdirectory.
Browse files Browse the repository at this point in the history
We say "SUBDIRECTORY_OK" but we did not chdir to toplevel; this
is fine as long as everything we use can be started from a
subdirectory, but unfortunately "merge-recursive" is not one of
the programs you can safely use from a subdirectory.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Jul 25, 2007
1 parent 4eb9947 commit ceff079
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions git-stash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions t/t3903-stash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ceff079

Please sign in to comment.