Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-04-02 03:23:21 +0400
committerJunio C Hamano <gitster@pobox.com>2011-04-02 03:23:21 +0400
commitbf87e09325f250ded42e1b2a024beb1a52f0d483 (patch)
treeb59157dcfb24b6e6753ddf8396b171b21f8c01aa
parentb7f6afe2df4f15e03b02217dbe4f2df182308d10 (diff)
parent3ba2e8653c88d220b0b22f35260477bb0afa7d7b (diff)
Merge branch 'js/maint-stash-index-copy' into maint
* 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
-rwxr-xr-xgit-stash.sh11
1 files changed, 5 insertions, 6 deletions
diff --git a/git-stash.sh b/git-stash.sh
index 7561b374d2..5130228909 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -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
@@ -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"