Code

Sync with 1.7.9.5
[git.git] / git-stash.sh
index 31dec0abf13ee7d6ded313b24253cd12254f1685..fe4ab28b2e10f85b20ff7892663cbb141fad4723 100755 (executable)
@@ -115,7 +115,8 @@ create_stash () {
                        git read-tree --index-output="$TMPindex" -m $i_tree &&
                        GIT_INDEX_FILE="$TMPindex" &&
                        export GIT_INDEX_FILE &&
-                       git diff --name-only -z HEAD | git update-index -z --add --remove --stdin &&
+                       git diff --name-only -z HEAD -- >"$TMP-stagenames" &&
+                       git update-index -z --add --remove --stdin <"$TMP-stagenames" &&
                        git write-tree &&
                        rm -f "$TMPindex"
                ) ) ||
@@ -134,7 +135,7 @@ create_stash () {
                w_tree=$(GIT_INDEX_FILE="$TMP-index" git write-tree) ||
                die "$(gettext "Cannot save the current worktree state")"
 
-               git diff-tree -p HEAD $w_tree "$TMP-patch" &&
+               git diff-tree -p HEAD $w_tree -- >"$TMP-patch" &&
                test -s "$TMP-patch" ||
                die "$(gettext "No changes selected")"
 
@@ -211,7 +212,7 @@ save_stash () {
 
        if test -n "$patch_mode" && test -n "$untracked"
        then
-           die "Can't use --patch and ---include-untracked or --all at the same time"
+           die "Can't use --patch and --include-untracked or --all at the same time"
        fi
 
        stash_msg="$*"
@@ -240,7 +241,7 @@ save_stash () {
                test "$untracked" = "all" && CLEAN_X_OPTION=-x || CLEAN_X_OPTION=
                if test -n "$untracked"
                then
-                       git clean --force --quiet $CLEAN_X_OPTION
+                       git clean --force --quiet -d $CLEAN_X_OPTION
                fi
 
                if test "$keep_index" = "t" && test -n $i_tree
@@ -491,7 +492,7 @@ drop_stash () {
                die "$(eval_gettext "\${REV}: Could not drop stash entry")"
 
        # clear_stash if we just dropped the last stash entry
-       git rev-parse --verify "$ref_stash@{0}" > /dev/null 2>&1 || clear_stash
+       git rev-parse --verify "$ref_stash@{0}" >/dev/null 2>&1 || clear_stash
 }
 
 apply_to_branch () {