<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/git-stash.sh, branch v2.21.4</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.21.4</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.21.4'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2018-11-18T23:24:34Z</updated>
<entry>
<title>stash: tolerate missing user identity</title>
<updated>2018-11-18T23:24:34Z</updated>
<author>
<name>Slavica Djukic</name>
<email>slavicadj.ip2018@gmail.com</email>
</author>
<published>2018-11-18T13:44:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3bc2111fc2e9e8ff33b48bb2ccd17b77ca7dbced'/>
<id>urn:sha1:3bc2111fc2e9e8ff33b48bb2ccd17b77ca7dbced</id>
<content type='text'>
The "git stash" command insists on having a usable user identity to
the same degree as the "git commit-tree" and "git commit" commands
do, because it uses the same codepath that creates commit objects
as these commands.

It is not strictly necesary to do so. Check if we will barf before
creating commit objects and then supply fake identity to please the
machinery that creates commits.
Add test to document that stash executes correctly both with and
without valid ident.

This is not that much of usability improvement, as the users who run
"git stash" would eventually want to record their changes that are
temporarily stored in the stashes in a more permanent history by
committing, and they must do "git config user.{name,email}" at that
point anyway, so arguably this change is only delaying a step that
is necessary to work in the repository.

Helped-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Slavica Djukic &lt;slawica92@hotmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'tg/stash-untracked-with-pathspec-fix'</title>
<updated>2018-04-09T23:25:45Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-04-09T23:25:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cbf033943978fca4aed24fc107485eb74c63ddde'/>
<id>urn:sha1:cbf033943978fca4aed24fc107485eb74c63ddde</id>
<content type='text'>
"git stash push -u -- &lt;pathspec&gt;" gave an unnecessary and confusing
error message when there was no tracked files that match the
&lt;pathspec&gt;, 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
</content>
</entry>
<entry>
<title>stash: drop superfluos pathspec parameter</title>
<updated>2018-03-21T22:07:46Z</updated>
<author>
<name>Thomas Gummerer</name>
<email>t.gummerer@gmail.com</email>
</author>
<published>2018-03-21T21:53:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=353278687e1a1a501c10431bcfe5605b5811d756'/>
<id>urn:sha1:353278687e1a1a501c10431bcfe5605b5811d756</id>
<content type='text'>
Since 833622a945 ("stash push: avoid printing errors", 2018-03-19) we
don't use the 'git clean' call for the pathspec case anymore.  The
commit however forgot to remove the pathspec argument to the call.
Remove the superfluos argument to make the code a little more obvious.

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 push -u: don't create empty stash</title>
<updated>2018-03-20T16:08:34Z</updated>
<author>
<name>Thomas Gummerer</name>
<email>t.gummerer@gmail.com</email>
</author>
<published>2018-03-19T23:21:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d319bb18b1bd3e0b7269b44b9bae5db99dfbb7dd'/>
<id>urn:sha1:d319bb18b1bd3e0b7269b44b9bae5db99dfbb7dd</id>
<content type='text'>
When introducing the stash push feature, and thus allowing users to pass
in a pathspec to limit the files that would get stashed in
df6bba0937 ("stash: teach 'push' (and 'create_stash') to honor
pathspec", 2017-02-28), this developer missed one place where the
pathspec should be passed in.

Namely in the call to the 'untracked_files()' function in the
'no_changes()' function.  This resulted in 'git stash push -u --
&lt;non-existant&gt;' creating an empty stash when there are untracked files
in the repository other that don't match the pathspec.

As 'git stash' never creates empty stashes, this behaviour is wrong and
confusing for users.  Instead it should just show a message "No local
changes to save", and not create a stash.

Luckily the 'untracked_files()' function already correctly respects
pathspecs that are passed to it, so the fix is simply to pass the
pathspec along to the function.

Reported-by: Marc Strapetz &lt;marc.strapetz@syntevo.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>stash push: avoid printing errors</title>
<updated>2018-03-20T16:08:34Z</updated>
<author>
<name>Thomas Gummerer</name>
<email>t.gummerer@gmail.com</email>
</author>
<published>2018-03-19T23:21:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=833622a945a677ec690e5ffb05a637e425591f1d'/>
<id>urn:sha1:833622a945a677ec690e5ffb05a637e425591f1d</id>
<content type='text'>
'git stash push -u -- &lt;pathspec&gt;' prints the following errors if
&lt;pathspec&gt; only matches untracked files:

    fatal: pathspec 'untracked' did not match any files
    error: unrecognized input

This is because we first clean up the untracked files using 'git clean
&lt;pathspec&gt;', and then use a command chain involving 'git add -u
&lt;pathspec&gt;' and 'git apply' to clear the changes to files that are in
the index and were stashed.

As the &lt;pathspec&gt; only includes untracked files that were already
removed by 'git clean', the 'git add' call will barf, and so will 'git
apply', as there are no changes that need to be applied.

Fix this by avoiding the 'git clean' if a pathspec is given, and use the
pipeline that's used for pathspec mode to get rid of the untracked files
as well.

Reported-by: Marc Strapetz &lt;marc.strapetz@syntevo.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>stash: fix nonsense pipeline</title>
<updated>2018-03-20T16:08:34Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-03-19T23:21:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d97e4fa748071635bb7e861ef0c1e7900fcae7c8'/>
<id>urn:sha1:d97e4fa748071635bb7e861ef0c1e7900fcae7c8</id>
<content type='text'>
An earlier change bba067d2 ("stash: don't delete untracked files
that match pathspec", 2018-01-06) was made by taking a suggestion in
a list discussion [1] but did not copy the suggested snippet
correctly.  And the bug was unnoticed during the review and slipped
through.

This fixes it.

[1] https://public-inbox.org/git/xmqqpo7byjwb.fsf@gitster.mtv.corp.google.com/

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'tg/stash-with-pathspec-fix'</title>
<updated>2018-01-23T21:16:39Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-01-23T21:16:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=087d1a8e9c49e5c11008582e92f346680d0d8c89'/>
<id>urn:sha1:087d1a8e9c49e5c11008582e92f346680d0d8c89</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>
</feed>
