threads / discuss / 52466

Fwd: `git stash pop -q` is deleting files.

Subject: Fwd: `git stash pop -q` is deleting files.

## tl;dr

5 messages between Dec 16, 2019 and Dec 17, 2019.

replies: 4people: 3as markdown or json

Marce Romagnoli· Dec 16, 2019, 13:19 UTC · lore

Hi list, this is my first time reporting (what I think is) a bug in git.

WHAT `git stash pop -q` untracks stashed files and others.

WHICH VERSION v2.24.1

HOW-TO REPRODUCE
- Create an empty repository
- Create 2 files, track them and commit.
- Change one of the files
- `git stash`
- `git stash pop -q`
-- Expected: The touched file is back in the index
-- Returned: All the files are no longer tracked.

We use this command on a pre-commit hook and we were scared for the first time we realized all our files were deleted, anyway, it was easy to go back.

Thanks for your time in advance.
Best,
Marcelo Romagnoli
Marce Romagnoli· Dec 17, 2019, 13:32 UTC · re: Junio C Hamano · lore

Re: Fwd: `git stash pop -q` is deleting files.

But it seems is still happening to me in 2.24.1 -latest-
Marcelo Romagnoli

El lun., 16 dic. 2019 a las 20:13, Junio C Hamano (<gitster@pobox.com>) escribió:

Show 7 quoted lines
>
> I think this has already been fixed with
>
> http://lore.kernel.org/git/20191113150136.GB3047@cat
>
> at the tip of 'master' a few weeks ago.
>
Thomas Gummerer· Dec 17, 2019, 13:59 UTC · re: Marce Romagnoli · lore

Re: Fwd: `git stash pop -q` is deleting files.

[please don't top-post on this list]
On 12/17, Marce Romagnoli wrote:
> But it seems is still happening to me in 2.24.1 -latest-

It being in master doesn't mean it has made it into a release yet, though it means it will in the future. So you have a couple of options in the meantime:

  - Compile Git yourself from the 'master' branch
  - Go back to an older version of git.  v2.23 didn't have this
    problem, but it had a different issue that I was trying to fix in
    34933d0eff ("stash: make sure to write refreshed cache",
    2019-09-11), but where this bug was introduced.
  - set the stash.useBuiltin configuration option to false, which will
    make you use the legacy stash written as a shell script.  This
    also shouldn't have this bug.
Show 9 quoted lines
> El lun., 16 dic. 2019 a las 20:13, Junio C Hamano
> (<gitster@pobox.com>) escribió:
> >
> > I think this has already been fixed with
> >
> > http://lore.kernel.org/git/20191113150136.GB3047@cat
> >
> > at the tip of 'master' a few weeks ago.
> >
Marce Romagnoli· Dec 17, 2019, 16:10 UTC · re: Thomas Gummerer · lore

Re: Fwd: `git stash pop -q` is deleting files.

Oh ok, thanks to everybody for your time!
Marcelo Romagnoli

El mar., 17 dic. 2019 a las 14:59, Thomas Gummerer (<t.gummerer@gmail.com>) escribió:

Show 28 quoted lines
>
> [please don't top-post on this list]
>
> On 12/17, Marce Romagnoli wrote:
> > But it seems is still happening to me in 2.24.1 -latest-
>
> It being in master doesn't mean it has made it into a release yet,
> though it means it will in the future.  So you have a couple of
> options in the meantime:
>
>   - Compile Git yourself from the 'master' branch
>   - Go back to an older version of git.  v2.23 didn't have this
>     problem, but it had a different issue that I was trying to fix in
>     34933d0eff ("stash: make sure to write refreshed cache",
>     2019-09-11), but where this bug was introduced.
>   - set the stash.useBuiltin configuration option to false, which will
>     make you use the legacy stash written as a shell script.  This
>     also shouldn't have this bug.
>
> > El lun., 16 dic. 2019 a las 20:13, Junio C Hamano
> > (<gitster@pobox.com>) escribió:
> > >
> > > I think this has already been fixed with
> > >
> > > http://lore.kernel.org/git/20191113150136.GB3047@cat
> > >
> > > at the tip of 'master' a few weeks ago.
> > >

← back to recent threads