From: Junio C Hamano Date: Wed, 23 Mar 2011 21:55:37 +0000 (-0700) Subject: Merge branch 'pk/stash-apply-status-relative' X-Git-Tag: v1.7.5-rc0~32 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/6fe519a91cc7131931ca50fedcdeb8e41453c892?hp=-c 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 --- 6fe519a91cc7131931ca50fedcdeb8e41453c892 diff --combined git-stash.sh index 5130228909,b59c201162..a305fb19f1 --- a/git-stash.sh +++ b/git-stash.sh @@@ -12,13 -12,13 +12,14 @@@ USAGE="list [ SUBDIRECTORY_OK=Yes OPTIONS_SPEC= + START_DIR=`pwd` . git-sh-setup require_work_tree cd_to_toplevel TMP="$GIT_DIR/.git-stash.$$" -trap 'rm -f "$TMP-*"' 0 +TMPindex=${GIT_INDEX_FILE-"$GIT_DIR/index"}.stash.$$ +trap 'rm -f "$TMP-"* "$TMPindex"' 0 ref_stash=refs/stash @@@ -82,12 -82,14 +83,12 @@@ create_stash () # state of the working tree w_tree=$( ( - rm -f "$TMP-index" && - cp -p ${GIT_INDEX_FILE-"$GIT_DIR/index"} "$TMP-index" && - GIT_INDEX_FILE="$TMP-index" && + git read-tree --index-output="$TMPindex" -m $i_tree && + GIT_INDEX_FILE="$TMPindex" && export GIT_INDEX_FILE && - git read-tree -m $i_tree && git diff --name-only -z HEAD | git update-index -z --add --remove --stdin && git write-tree && - rm -f "$TMP-index" + rm -f "$TMPindex" ) ) || die "Cannot save the current worktree state" @@@ -393,7 -395,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=$?