<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/git-stash.sh, branch v2.16.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.16.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.16.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2018-02-15T23:18:13Z</updated>
<entry>
<title>Merge branch 'tg/stash-with-pathspec-fix' into maint</title>
<updated>2018-02-15T23:18:13Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-02-15T23:18:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=984c8337de2e2d610d36426226c08a14b43af23f'/>
<id>urn:sha1:984c8337de2e2d610d36426226c08a14b43af23f</id>
<content type='text'>
"git stash -- &lt;pathspec&gt;" incorrectly blew away untracked files in
the directory that matched the pathspec, which has been corrected.

* tg/stash-with-pathspec-fix:
  stash: don't delete untracked files that match pathspec
</content>
</entry>
<entry>
<title>stash: don't delete untracked files that match pathspec</title>
<updated>2018-01-08T21:02:25Z</updated>
<author>
<name>Thomas Gummerer</name>
<email>t.gummerer@gmail.com</email>
</author>
<published>2018-01-06T00:24:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bba067d2faf047597bc76f885fb0cf87894b5ed1'/>
<id>urn:sha1:bba067d2faf047597bc76f885fb0cf87894b5ed1</id>
<content type='text'>
Currently when 'git stash push -- &lt;pathspec&gt;' is used, untracked files
that match the pathspec will be deleted, even though they do not end up
in a stash anywhere.

This is because the original commit introducing the pathspec feature in
git stash push (df6bba0937 ("stash: teach 'push' (and 'create_stash') to
honor pathspec", 2017-02-28)) used the sequence of 'git reset &lt;pathspec&gt;
&amp;&amp; git ls-files --modified &lt;pathspec&gt; | git checkout-index &amp;&amp; git clean
&lt;pathspec&gt;'.

The intention was to emulate what 'git reset --hard -- &lt;pathspec&gt;' would
do.  The call to 'git clean' was supposed to clean up the files that
were unstaged by 'git reset'.  This would work fine if the pathspec
doesn't match any files that were untracked before 'git stash push --
&lt;pathspec&gt;'.  However if &lt;pathspec&gt; matches a file that was untracked
before invoking the 'stash' command, all untracked files matching the
pathspec would inadvertently be deleted as well, even though they
wouldn't end up in the stash, and are therefore lost.

This behaviour was never what was intended, only blobs that also end up
in the stash should be reset to their state in HEAD, previously
untracked files should be left alone.

To achieve this, first match what's in the index and what's in the
working tree by adding all changes to the index, ask diff-index what
changed between HEAD and the current index, and then apply that patch in
reverse to get rid of the changes, which includes removal of added
files and resurrection of removed files.

Reported-by: Reid Price &lt;reid.price@gmail.com&gt;
Helped-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Thomas Gummerer &lt;t.gummerer@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ph/stash-save-m-option-fix'</title>
<updated>2017-12-06T17:23:43Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-12-06T17:23:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=714485c7deb63e91b1ee7ba07be5f5a55fe03a39'/>
<id>urn:sha1:714485c7deb63e91b1ee7ba07be5f5a55fe03a39</id>
<content type='text'>
In addition to "git stash -m message", the command learned to
accept "git stash -mmessage" form.

* ph/stash-save-m-option-fix:
  stash: learn to parse -m/--message like commit does
</content>
</entry>
<entry>
<title>stash: learn to parse -m/--message like commit does</title>
<updated>2017-11-24T05:47:44Z</updated>
<author>
<name>Phil Hord</name>
<email>phil.hord@gmail.com</email>
</author>
<published>2017-11-22T21:20:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5675473fcbd18fb320ca17cffc107506f09c7464'/>
<id>urn:sha1:5675473fcbd18fb320ca17cffc107506f09c7464</id>
<content type='text'>
`git stash push -m foo` uses "foo" as the message for the stash. But
`git stash push -m"foo"` does not parse successfully.  Similarly
`git stash push --message="My stash message"` also fails.  The stash
documentation doesn't suggest this syntax should work, but gitcli
does and my fingers have learned this pattern long ago for `commit`.

Teach `git stash` to parse -mFoo and --message=Foo the same as `git
commit` would do.  Even though it's an internal function, add
similar support to create_stash() for consistency.

Signed-off-by: Phil Hord &lt;phil.hord@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>stash: remove now superfluos help for "stash push"</title>
<updated>2017-10-27T00:59:11Z</updated>
<author>
<name>Thomas Gummerer</name>
<email>t.gummerer@gmail.com</email>
</author>
<published>2017-10-22T17:04:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c0c0c825ce19963ded30919778a23c3c85662755'/>
<id>urn:sha1:c0c0c825ce19963ded30919778a23c3c85662755</id>
<content type='text'>
With the 'git stash save' interface, it was easily possible for users to
try to add a message which would start with "-", which 'git stash save'
would interpret as a command line argument, and fail.  For this case we
added some extra help on how to create a stash with a message starting
with "-".

For 'stash push', messages are passed with the -m flag, avoiding this
potential pitfall.  Now only pathspecs starting with "-" would have to
be distinguished from command line parameters by using
"-- --&lt;pathspec&gt;".  This is fairly common in the git command line
interface, and we don't try to guess what the users wanted in the other
cases.

Because this way of passing pathspecs is quite common in other git
commands, and we don't provide any extra help there, do the same in the
error message for 'git stash push'.

Signed-off-by: Thomas Gummerer &lt;t.gummerer@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>stash: replace "git stash save" with "git stash push" in the documentation</title>
<updated>2017-10-27T00:58:38Z</updated>
<author>
<name>Thomas Gummerer</name>
<email>t.gummerer@gmail.com</email>
</author>
<published>2017-10-22T17:04:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=db37745eef62c57e1609cbd50c6dbf9a8066f191'/>
<id>urn:sha1:db37745eef62c57e1609cbd50c6dbf9a8066f191</id>
<content type='text'>
"git stash push" is the newer interface for creating a stash.  While we
are still keeping "git stash save" around for the time being, it's better
to point new users of "git stash" to the more modern (and more feature
rich) interface, instead of teaching them the older version that we
might want to phase out in the future.

Signed-off-by: Thomas Gummerer &lt;t.gummerer@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'mf/no-dashed-subcommands' into maint</title>
<updated>2017-09-10T08:02:56Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-09-10T08:02:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=036e1274a2e230462ce7b201de760bb12260a516'/>
<id>urn:sha1:036e1274a2e230462ce7b201de760bb12260a516</id>
<content type='text'>
Code clean-up.

* mf/no-dashed-subcommands:
  scripts: use "git foo" not "git-foo"
</content>
</entry>
<entry>
<title>Merge branch 'kd/stash-with-bash-4.4'</title>
<updated>2017-08-23T21:13:08Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-08-23T21:13:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ef9408cfb5eca8524047c56ba10df9664425a14c'/>
<id>urn:sha1:ef9408cfb5eca8524047c56ba10df9664425a14c</id>
<content type='text'>
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
</content>
</entry>
<entry>
<title>Merge branch 'nm/stash-untracked'</title>
<updated>2017-08-23T21:13:07Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-08-23T21:13:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0ca2f3241aadd99265b3e864fe68dddffdeff84f'/>
<id>urn:sha1:0ca2f3241aadd99265b3e864fe68dddffdeff84f</id>
<content type='text'>
"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
</content>
</entry>
<entry>
<title>stash: prevent warning about null bytes in input</title>
<updated>2017-08-14T22:35:48Z</updated>
<author>
<name>Kevin Daudt</name>
<email>me@ikke.info</email>
</author>
<published>2017-08-14T21:43:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5fc92f8828b117d042344e4733e16195b264365b'/>
<id>urn:sha1:5fc92f8828b117d042344e4733e16195b264365b</id>
<content type='text'>
The `no_changes` function calls the `untracked_files` function through
command substitution. `untracked_files` will return null bytes because it
runs ls-files with the '-z' option.

Bash since version 4.4 warns about these null bytes. As they are not
required for the test that is being done, make sure `untracked_files`
does not output null bytes when not required.

This is achieved by adding a parameter to the `untracked_files` function to
specify wither `-z` should be passed to ls-files or not.

This warning is triggered when running git stash save -u resulting in
two warnings:

    git-stash: line 43: warning: command substitution: ignored null byte
    in input

Signed-off-by: Kevin Daudt &lt;me@ikke.info&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
