Skip to content

Commit

Permalink
Merge branch 'js/maint-stash-index-copy'
Browse files Browse the repository at this point in the history
* js/maint-stash-index-copy:
  stash: copy the index using --index-output instead of cp -p
  stash: fix incorrect quoting in cleanup of temporary files
  • Loading branch information
gitster committed Mar 23, 2011
2 parents f9249ec + 3ba2e86 commit 281ee1d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions git-stash.sh
Expand Up @@ -17,7 +17,8 @@ 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

Expand Down Expand Up @@ -81,14 +82,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"

Expand Down

0 comments on commit 281ee1d

Please sign in to comment.