All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Strapetz <marc.strapetz@syntevo.com>
To: Thomas Gummerer <t.gummerer@gmail.com>, git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2 1/2] stash push: avoid printing errors
Date: Thu, 15 Mar 2018 09:51:48 +0100	[thread overview]
Message-ID: <d9588594-10fd-1080-abda-aeeb12948b2c@syntevo.com> (raw)
In-Reply-To: <20180314214642.22185-1-t.gummerer@gmail.com>

On 14.03.2018 22:46, Thomas Gummerer wrote:
> Currently 'git stash push -u -- <pathspec>' prints the following errors
> if <pathspec> 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
> <pathspec>', and then use a command chain involving 'git add -u
> <pathspec>' and 'git apply' to clear the changes to files that are in
> the index and were stashed.
> 
> As the <pathspec> 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 making sure to only call this command chain if there are
> still files that match <pathspec> after the call to 'git clean'.
> 
> Reported-by: Marc Strapetz <marc.strapetz@syntevo.com>
> Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
> ---
> 
>> Either way I'll try to address this as soon as I can get some
>> time to look at it.
> 
> I finally got around to do this.  The fix (in the second patch) turns
> out to be fairly simple, I just forgot to pass the pathspec along to
> one function whene originally introducing the pathspec feature in git
> stash push (more explanation in the commit message for the patch
> itself).  Thanks Marc for reporting the two breakages!

Thanks, I confirm that both issues are resolved. There is another issue 
now which seems to be a regression. When *successfully* stashing an 
untracked file, local modifications of other files are cleared, too.

$ git init
$ touch file1
$ git add file1
$ git commit -m "initial import"
$ echo "a" > file1
$ touch file2
$ git status --porcelain
  M file1
?? file2
$ git stash push -u -- file2
Saved working directory and index state WIP on master: 25352d7 initial 
import
$ git status
On branch master
nothing to commit, working tree clean

Hence, by stashing just "file2" the local modification of "file1" became 
reset.

-Marc





  parent reply	other threads:[~2018-03-15  8:52 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-03  9:44 git stash push -u always warns "pathspec '...' did not match any files" Marc Strapetz
2018-03-03 15:46 ` Thomas Gummerer
2018-03-04 10:44   ` Marc Strapetz
2018-03-09 22:18     ` Junio C Hamano
2018-03-10  9:18       ` Marc Strapetz
2018-03-10 11:12         ` Thomas Gummerer
2018-03-14 21:46           ` [PATCH v2 1/2] stash push: avoid printing errors Thomas Gummerer
2018-03-14 21:46             ` [PATCH v2 2/2] stash push -u: don't create empty stash Thomas Gummerer
2018-03-15 20:09               ` Junio C Hamano
2018-03-16 20:10                 ` Thomas Gummerer
2018-03-15  8:51             ` Marc Strapetz [this message]
2018-03-16 20:12               ` [PATCH v2 1/2] stash push: avoid printing errors Thomas Gummerer
2018-03-16 20:43             ` [PATCH v3 0/2] stash push -u -- <pathspec> fixes Thomas Gummerer
2018-03-16 20:43               ` [PATCH v3 1/2] stash push: avoid printing errors Thomas Gummerer
2018-03-16 21:31                 ` Junio C Hamano
2018-03-16 20:43               ` [PATCH v3 2/2] stash push -u: don't create empty stash Thomas Gummerer
2018-03-16 22:37               ` [PATCH v4 0/3] stash push -u -- <pathspec> fixes Junio C Hamano
2018-03-16 22:37                 ` [PATCH v4 1/3] stash: fix nonsense pipeline Junio C Hamano
2018-03-16 22:37                 ` [PATCH v4 2/3] stash push: avoid printing errors Junio C Hamano
2018-03-16 22:37                 ` [PATCH v4 3/3] stash push -u: don't create empty stash Junio C Hamano
2018-03-17 11:36                 ` [PATCH v4 0/3] stash push -u -- <pathspec> fixes Thomas Gummerer
2018-03-19 23:21                 ` [PATCH v5 " Thomas Gummerer
2018-03-19 23:21                   ` [PATCH v5 1/3] stash: fix nonsense pipeline Thomas Gummerer
2018-03-19 23:21                   ` [PATCH v5 2/3] stash push: avoid printing errors Thomas Gummerer
2018-03-20 16:54                     ` Junio C Hamano
2018-03-21 21:36                       ` Thomas Gummerer
2018-03-21 21:53                         ` [PATCH] stash: drop superfluos pathspec parameter (was: Re: [PATCH v5 2/3] stash push: avoid printing errors) Thomas Gummerer
2018-03-21 22:07                           ` [PATCH] stash: drop superfluos pathspec parameter Junio C Hamano
2018-03-21 21:56                         ` [PATCH v5 2/3] stash push: avoid printing errors Junio C Hamano
2018-03-19 23:21                   ` [PATCH v5 3/3] stash push -u: don't create empty stash Thomas Gummerer
2018-03-20 10:06                   ` [PATCH v5 0/3] stash push -u -- <pathspec> fixes Marc Strapetz
2018-03-19 15:44               ` [PATCH v3 0/2] " Marc Strapetz
2018-03-19 21:51                 ` Thomas Gummerer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d9588594-10fd-1080-abda-aeeb12948b2c@syntevo.com \
    --to=marc.strapetz@syntevo.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=t.gummerer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.