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>2018-04-10 02:25:45 +0300
committerJunio C Hamano <gitster@pobox.com>2018-04-10 02:25:45 +0300
commitcbf033943978fca4aed24fc107485eb74c63ddde (patch)
treea643c2afcd4036c28be7222cf123bdbcd6e669af /git-stash.sh
parentca923f72653f5bfc61933ee334ca5fe34d4fe5f0 (diff)
parent353278687e1a1a501c10431bcfe5605b5811d756 (diff)
Merge branch 'tg/stash-untracked-with-pathspec-fix'
"git stash push -u -- <pathspec>" gave an unnecessary and confusing error message when there was no tracked files that match the <pathspec>, which has been fixed. * tg/stash-untracked-with-pathspec-fix: stash: drop superfluos pathspec parameter stash push -u: don't create empty stash stash push: avoid printing errors stash: fix nonsense pipeline
Diffstat (limited to 'git-stash.sh')
-rwxr-xr-xgit-stash.sh14
1 files changed, 8 insertions, 6 deletions
diff --git a/git-stash.sh b/git-stash.sh
index fc8f8ae640..94793c1a91 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -39,7 +39,7 @@ fi
no_changes () {
git diff-index --quiet --cached HEAD --ignore-submodules -- "$@" &&
git diff-files --quiet --ignore-submodules -- "$@" &&
- (test -z "$untracked" || test -z "$(untracked_files)")
+ (test -z "$untracked" || test -z "$(untracked_files "$@")")
}
untracked_files () {
@@ -315,16 +315,18 @@ push_stash () {
if test -z "$patch_mode"
then
test "$untracked" = "all" && CLEAN_X_OPTION=-x || CLEAN_X_OPTION=
- if test -n "$untracked"
+ if test -n "$untracked" && test $# = 0
then
- git clean --force --quiet -d $CLEAN_X_OPTION -- "$@"
+ git clean --force --quiet -d $CLEAN_X_OPTION
fi
if test $# != 0
then
- git add -u -- "$@" |
- git checkout-index -z --force --stdin
- git diff-index -p --cached --binary HEAD -- "$@" | git apply --index -R
+ test -z "$untracked" && UPDATE_OPTION="-u" || UPDATE_OPTION=
+ test "$untracked" = "all" && FORCE_OPTION="--force" || FORCE_OPTION=
+ git add $UPDATE_OPTION $FORCE_OPTION -- "$@"
+ git diff-index -p --cached --binary HEAD -- "$@" |
+ git apply --index -R
else
git reset --hard -q
fi