From: Junio C Hamano Date: Wed, 23 Aug 2017 21:13:07 +0000 (-0700) Subject: Merge branch 'nm/stash-untracked' X-Git-Tag: v2.15.0-rc0~153 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/0ca2f3241aadd99265b3e864fe68dddffdeff84f?hp=-c Merge branch 'nm/stash-untracked' "git stash -u" used the contents of the committed version of the ".gitignore" file to decide which paths are ignored, even when the file has local changes. The command has been taught to instead use the locally modified contents. * nm/stash-untracked: stash: clean untracked files before reset --- 0ca2f3241aadd99265b3e864fe68dddffdeff84f diff --combined git-stash.sh index 9aa09c3a33,39083b4d97..d7bc3224bf --- a/git-stash.sh +++ b/git-stash.sh @@@ -300,6 -300,12 +300,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 -- "$@" @@@ -309,11 -315,6 +315,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 @@@ -573,7 -574,7 +574,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")"