git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: possible bug of git stash deleting uncommitted files in corner case

From
Remi Galan Alfonso <remi.galan-alfonso@ensimag.grenoble-inp.fr>
Date
Apr 22, 2016, 19:04 UTC
Message-ID
<754076461.4029096.1461351865455.JavaMail.zimbra@ensimag.grenoble-inp.fr>
In-Reply-To
<xmqqmvolpmsw.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 15 quoted lines
> Remi Galan Alfonso <remi.galan-alfonso@ensimag.grenoble-inp.fr>
> writes:
> 
> > Daniele Segato <daniele.segato@gmail.com> wrote:
> > ...
> >> git version 1.9.1
> >
> > Contrary to what I expected, this seems to still be the case with:
> >   $ git --version
> >   git version 2.8.0.rc2
> 
> I do not think "git stash" has been updated in any major way to
> address correctness (including its corner case behaviour) ever since
> it was originally written, so it is very likely that any bug you see
> would be with it since the very old days.

For this bug it doesn't seem to be specifically linked to git stash, since 'git status' doesn't display correct informations in the first place (it doesn't show foo/bar as an untracked file).

I tried something quickly, based on Daniele's case:
    git init
    echo 'X' >foo
    git add foo
    git commit -m "Added foo"
    rm foo
    mkdir foo
    echo 'B' >foo/bar
    git status # foo/bar not shown in Untracked files
    git add foo/bar

git status then shows as expected: # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # deleted: foo # new file: foo/bar

However git stash fails this time: # error: foo: is a directory - add individual files instead # fatal: Unable to process path foo # Cannot save the current worktree state

I am not sure what should be the correct behaviour here. This however might be one of the corner cases you mentionned.

Thanks, Rémi

Previous: Junio C HamanoNext: Jeff King
Message 5 of 6 in “possible bug of git stash deleting uncommitted files in corner case”
  1. Daniele SegatoApr 22, 2016
  2. Daniele SegatoApr 22, 2016
  3. Remi Galan AlfonsoApr 22, 2016
  4. Junio C HamanoApr 22, 2016
  5. Remi Galan AlfonsoApr 22, 2016
  6. Jeff KingApr 23, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.