From: Junio C Hamano Date: Sun, 20 Aug 2017 06:07:16 +0000 (-0700) Subject: Merge branch 'kd/stash-with-bash-4.4' into next X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/79b2c4b052e93d1aab5183b81621690417583f0a?hp=-c Merge branch 'kd/stash-with-bash-4.4' into next bash 4.4 or newer gave a warning on NUL byte in command substitution done in "git stash"; this has been squelched. * kd/stash-with-bash-4.4: stash: prevent warning about null bytes in input --- 79b2c4b052e93d1aab5183b81621690417583f0a diff --combined git-stash.sh index d7bc3224bf,5f09a47f0a..8b2ce9afda --- a/git-stash.sh +++ b/git-stash.sh @@@ -43,9 -43,16 +43,16 @@@ no_changes () } untracked_files () { + if test "$1" = "-z" + then + shift + z=-z + else + z= + fi excl_opt=--exclude-standard test "$untracked" = "all" && excl_opt= - git ls-files -o -z $excl_opt -- "$@" + git ls-files -o $z $excl_opt -- "$@" } clear_stash () { @@@ -114,7 -121,7 +121,7 @@@ create_stash () # Untracked files are stored by themselves in a parentless commit, for # ease of unpacking later. u_commit=$( - untracked_files "$@" | ( + untracked_files -z "$@" | ( GIT_INDEX_FILE="$TMPindex" && export GIT_INDEX_FILE && rm -f "$TMPindex" && @@@ -300,12 -307,6 +307,12 @@@ push_stash () if test -z "$patch_mode" then + test "$untracked" = "all" && CLEAN_X_OPTION=-x || CLEAN_X_OPTION= + if test -n "$untracked" + then + git clean --force --quiet -d $CLEAN_X_OPTION -- "$@" + fi + if test $# != 0 then git reset -q -- "$@" @@@ -315,6 -316,11 +322,6 @@@ else git reset --hard -q fi - test "$untracked" = "all" && CLEAN_X_OPTION=-x || CLEAN_X_OPTION= - if test -n "$untracked" - then - git clean --force --quiet -d $CLEAN_X_OPTION -- "$@" - fi if test "$keep_index" = "t" && test -n "$i_tree" then @@@ -574,7 -580,7 +581,7 @@@ apply_stash () if test -n "$u_tree" then - GIT_INDEX_FILE="$TMPindex" git-read-tree "$u_tree" && + GIT_INDEX_FILE="$TMPindex" git read-tree "$u_tree" && GIT_INDEX_FILE="$TMPindex" git checkout-index --all && rm -f "$TMPindex" || die "$(gettext "Could not restore untracked files from stash entry")"