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
This commit is contained in:
commit
0ca2f3241a
11
git-stash.sh
11
git-stash.sh
@ -300,6 +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 @@ push_stash () {
|
||||
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
|
||||
|
@ -211,4 +211,21 @@ test_expect_success 'stash push with $IFS character' '
|
||||
test_path_is_file bar
|
||||
'
|
||||
|
||||
cat > .gitignore <<EOF
|
||||
ignored
|
||||
ignored.d/*
|
||||
EOF
|
||||
|
||||
test_expect_success 'stash previously ignored file' '
|
||||
git reset HEAD &&
|
||||
git add .gitignore &&
|
||||
git commit -m "Add .gitignore" &&
|
||||
>ignored.d/foo &&
|
||||
echo "!ignored.d/foo" >> .gitignore &&
|
||||
git stash save --include-untracked &&
|
||||
test_path_is_missing ignored.d/foo &&
|
||||
git stash pop &&
|
||||
test_path_is_file ignored.d/foo
|
||||
'
|
||||
|
||||
test_done
|
||||
|
Loading…
Reference in New Issue
Block a user