summaryrefslogtreecommitdiff
path: root/git-stash.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-08-23 14:13:08 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-08-23 14:13:08 -0700
commitef9408cfb5eca8524047c56ba10df9664425a14c (patch)
tree4731b7d75b9663de1146c38a0cbfb4e11e47eeea /git-stash.sh
parentMerge branch 'ah/doc-empty-string-is-false' (diff)
parentstash: prevent warning about null bytes in input (diff)
downloadtgif-ef9408cfb5eca8524047c56ba10df9664425a14c.tar.xz
Merge branch 'kd/stash-with-bash-4.4'
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
Diffstat (limited to 'git-stash.sh')
-rwxr-xr-xgit-stash.sh11
1 files changed, 9 insertions, 2 deletions
diff --git a/git-stash.sh b/git-stash.sh
index d7bc3224bf..8b2ce9afda 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -43,9 +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 @@ 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" &&