git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [bug] git stash push {dir-pathspec} wipes untracked files
@ 2018-03-15 16:40 Jake Stine
  2018-03-15 16:52 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Jake Stine @ 2018-03-15 16:40 UTC (permalink / raw)
  To: git

Hi, I ran into what I believe is a bug today.  I’m using primarily Git
for Windows 2.16.2 and also reproduced the behavior on Git for Windows
2.15.1 and Git 2.14.1 on Ubuntu:

Given any repository with at least one subdirectory:

1.       Create some untracked files in the subdir
2.       Modify a tracked file in the subdir
3.       Execute `git stash push subdir`
4.       The untracked files will be removed, without warning.

`git stash push` behaves as-expcted and does not touch untracked
files.  It’s only when a directory tree is specified as [pathspec]
that the problem occurs.

Here's the precise reproduction case executed on a linux box:

jake@jake-VirtualBox:~/woot$ git --version
git version 2.14.1
jake@jake-VirtualBox:~/woot$ git config --global user.email jake.stine@gmail.com
jake@jake-VirtualBox:~/woot$ git config --global user.name "Jake Stine"
jake@jake-VirtualBox:~$ git init woot
Initialized empty Git repository in /home/jake/woot/.git/
jake@jake-VirtualBox:~$ cd woot
jake@jake-VirtualBox:~/woot$ mkdir subdir
jake@jake-VirtualBox:~/woot$ echo "test" > meh.txt
jake@jake-VirtualBox:~/woot$ echo "test" > subdir/meh2.txt
jake@jake-VirtualBox:~/woot$ git add meh.txt subdir/meh2.txt
jake@jake-VirtualBox:~/woot$ git commit --message="stash bug testing"
jake@jake-VirtualBox:~/woot$ git commit --message="stash bug testing"
[master (root-commit) 2c05580] stash bug testing
 2 files changed, 2 insertions(+)
 create mode 100644 meh.txt
 create mode 100644 subdir/meh2.txt
jake@jake-VirtualBox:~/woot$ echo "test" > subdir/untracked.txt
jake@jake-VirtualBox:~/woot$ echo "append" >> subdir/meh2.txt
jake@jake-VirtualBox:~/woot$ git stash push subdir
Saved working directory and index state WIP on master: 2c05580 stash bug testing
jake@jake-VirtualBox:~/woot$ ls subdir
meh2.txt


The expected result is that when I do `ls subdir` the file
"untracked.txt" still exists.  Alternatively, git stash should warn me
before destroying my untracked files, and require I specify --force or
similar to invoke destructive behavior.


Thanks!
Jake Stine

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [bug] git stash push {dir-pathspec} wipes untracked files
  2018-03-15 16:40 [bug] git stash push {dir-pathspec} wipes untracked files Jake Stine
@ 2018-03-15 16:52 ` Junio C Hamano
  2018-03-15 17:02   ` Randall S. Becker
  2018-03-15 20:39   ` Igor Djordjevic
  0 siblings, 2 replies; 4+ messages in thread
From: Junio C Hamano @ 2018-03-15 16:52 UTC (permalink / raw)
  To: Jake Stine; +Cc: git

Jake Stine <jake.stine@gmail.com> writes:

> Hi, I ran into what I believe is a bug today.  I’m using primarily Git
> for Windows 2.16.2 and also reproduced the behavior on Git for Windows
> 2.15.1 and Git 2.14.1 on Ubuntu:
>
> Given any repository with at least one subdirectory:
>
> 1.       Create some untracked files in the subdir
> 2.       Modify a tracked file in the subdir
> 3.       Execute `git stash push subdir`
> 4.       The untracked files will be removed, without warning.
>
> `git stash push` behaves as-expcted and does not touch untracked
> files.  It’s only when a directory tree is specified as [pathspec]
> that the problem occurs.

I wonder if this is the same as the topic on this thread.

  https://public-inbox.org/git/CA+HNv10i7AvWXjrQjxxy1LNJTmhr7LE4TwxhHUYBiWtmJCOf_A@mail.gmail.com/

What is curious is that the fix bba067d2 ("stash: don't delete
untracked files that match pathspec", 2018-01-06) appeared first in
2.16.2, on which Windows 2.16.2 is supposed to be built upon.

> Here's the precise reproduction case executed on a linux box:

This does not reproduce for me with v2.16.2-17-g38e79b1fda (the tip
of 'maint'); I do not have an  install of vanilla v2.16.2 handy, but
I suspect v2.16.2 would work just fine, too.

> jake@jake-VirtualBox:~/woot$ git --version
> git version 2.14.1
> ...
> The expected result is that when I do `ls subdir` the file
> "untracked.txt" still exists.  Alternatively, git stash should warn me
> before destroying my untracked files, and require I specify --force or
> similar to invoke destructive behavior.
>
>
> Thanks!
> Jake Stine

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [bug] git stash push {dir-pathspec} wipes untracked files
  2018-03-15 16:52 ` Junio C Hamano
@ 2018-03-15 17:02   ` Randall S. Becker
  2018-03-15 20:39   ` Igor Djordjevic
  1 sibling, 0 replies; 4+ messages in thread
From: Randall S. Becker @ 2018-03-15 17:02 UTC (permalink / raw)
  To: 'Junio C Hamano', 'Jake Stine'; +Cc: git



> -----Original Message-----
> From: git-owner@vger.kernel.org <git-owner@vger.kernel.org> On Behalf
> Of Junio C Hamano
> Sent: March 15, 2018 12:52 PM
> To: Jake Stine <jake.stine@gmail.com>
> Cc: git@vger.kernel.org
> Subject: Re: [bug] git stash push {dir-pathspec} wipes untracked files
> 
> Jake Stine <jake.stine@gmail.com> writes:
> 
> > Hi, I ran into what I believe is a bug today.  I’m using primarily Git
> > for Windows 2.16.2 and also reproduced the behavior on Git for Windows
> > 2.15.1 and Git 2.14.1 on Ubuntu:
> >
> > Given any repository with at least one subdirectory:
> >
> > 1.       Create some untracked files in the subdir
> > 2.       Modify a tracked file in the subdir
> > 3.       Execute `git stash push subdir`
> > 4.       The untracked files will be removed, without warning.
> >
> > `git stash push` behaves as-expcted and does not touch untracked
> > files.  It’s only when a directory tree is specified as [pathspec]
> > that the problem occurs.
> 
> I wonder if this is the same as the topic on this thread.
> 
>   https://public-
> inbox.org/git/CA+HNv10i7AvWXjrQjxxy1LNJTmhr7LE4TwxhHUYBiWtmJCOf_
> A@mail.gmail.com/
> 
> What is curious is that the fix bba067d2 ("stash: don't delete untracked files
> that match pathspec", 2018-01-06) appeared first in 2.16.2, on which
> Windows 2.16.2 is supposed to be built upon.
> 
> > Here's the precise reproduction case executed on a linux box:
> 
> This does not reproduce for me with v2.16.2-17-g38e79b1fda (the tip of
> 'maint'); I do not have an  install of vanilla v2.16.2 handy, but I suspect v2.16.2
> would work just fine, too.

This does not reproduce for me either in v2.16.2.9-g3dbadef9f (which is the NonStop port of 2.16.2)

On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   subdir/a

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        subdir/b

no changes added to commit (use "git add" and/or "git commit -a")
/home/randall/foot: git stash push subdir
Saved working directory and index state WIP on master: b772270 i
/home/randall/foot: ls subdir
a  b
/home/randall/foot: git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        subdir/b

nothing added to commit but untracked files present (use "git add" to track)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [bug] git stash push {dir-pathspec} wipes untracked files
  2018-03-15 16:52 ` Junio C Hamano
  2018-03-15 17:02   ` Randall S. Becker
@ 2018-03-15 20:39   ` Igor Djordjevic
  1 sibling, 0 replies; 4+ messages in thread
From: Igor Djordjevic @ 2018-03-15 20:39 UTC (permalink / raw)
  To: Junio C Hamano, Jake Stine; +Cc: git

On 15/03/2018 17:52, Junio C Hamano wrote:
> 
> > Hi, I ran into what I believe is a bug today.  I’m using primarily Git
> > for Windows 2.16.2 and also reproduced the behavior on Git for Windows
> > 2.15.1 and Git 2.14.1 on Ubuntu:
> >
> > Given any repository with at least one subdirectory:
> >
> > 1.       Create some untracked files in the subdir
> > 2.       Modify a tracked file in the subdir
> > 3.       Execute `git stash push subdir`
> > 4.       The untracked files will be removed, without warning.
> >
> > `git stash push` behaves as-expcted and does not touch untracked
> > files.  It’s only when a directory tree is specified as [pathspec]
> > that the problem occurs.
> 
> I wonder if this is the same as the topic on this thread.
> 
>   https://public-inbox.org/git/CA+HNv10i7AvWXjrQjxxy1LNJTmhr7LE4TwxhHUYBiWtmJCOf_A@mail.gmail.com/
> 
> What is curious is that the fix bba067d2 ("stash: don't delete
> untracked files that match pathspec", 2018-01-06) appeared first in
> 2.16.2, on which Windows 2.16.2 is supposed to be built upon.
> 
> > Here's the precise reproduction case executed on a linux box:
> 
> This does not reproduce for me with v2.16.2-17-g38e79b1fda (the tip
> of 'maint'); I do not have an  install of vanilla v2.16.2 handy, but
> I suspect v2.16.2 would work just fine, too.
> 
> > jake@jake-VirtualBox:~/woot$ git --version
> > git version 2.14.1
> > ...
> > The expected result is that when I do `ls subdir` the file
> > "untracked.txt" still exists.  Alternatively, git stash should warn me
> > before destroying my untracked files, and require I specify --force or
> > similar to invoke destructive behavior.

I can't seem to reproduce this on 2.16.2.windows.1, either:

+ git --version
git version 2.16.2.windows.1
+ git init woot
Initialized empty Git repository in /woot/.git/
+ cd woot
+ mkdir subdir
+ echo test
+ echo test
+ git add meh.txt subdir/meh2.txt
+ git commit '--message=stash bug testing'
[master (root-commit) afec47d] stash bug testing
 2 files changed, 2 insertions(+)
 create mode 100644 meh.txt
 create mode 100644 subdir/meh2.txt
+ git commit '--message=stash bug testing'
On branch master
nothing to commit, working tree clean
+ echo test
+ echo append
+ git stash push subdir
Saved working directory and index state WIP on master: afec47d stash bug testing
+ ls subdir
meh2.txt  untracked.txt

Regards, Buga

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-15 20:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-15 16:40 [bug] git stash push {dir-pathspec} wipes untracked files Jake Stine
2018-03-15 16:52 ` Junio C Hamano
2018-03-15 17:02   ` Randall S. Becker
2018-03-15 20:39   ` Igor Djordjevic

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).