git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Remi Galan Alfonso <remi.galan-alfonso@ensimag.grenoble-inp.fr>
To: Daniele Segato <daniele.segato@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: possible bug of git stash deleting uncommitted files in corner case
Date: Fri, 22 Apr 2016 14:29:46 +0200 (CEST)	[thread overview]
Message-ID: <1304154573.4013923.1461328186541.JavaMail.zimbra@ensimag.grenoble-inp.fr> (raw)
In-Reply-To: <CAND5yRvU1-AgvQW106fHbNN-GRQ615HjTDjR6AY9gkpoquBgDw@mail.gmail.com>

Daniele Segato <daniele.segato@gmail.com> wrote:
> git init
> echo 'X' > foo
> git add foo
> git commit -m 'foo file committed'
> 
> rm foo
> mkdir foo
> echo 'B' > foo/bar
> 
> # git status
> 
> git stash
> 
> at this point stash deleted the "bar" file, in his case all the work
> on the previous couple of hours, but he didn't know yet
> 
> the foo directory was gone, replaced by the foo file
> 
> git stash pop
> 
> did not complained and deleted foo file again
> 
> I know my co-worker shouldn't had created a directory with the same
> file he was deleting but I also think git shouldn't have allowed him
> to stash at all, or should have been clever enough to actually stash
> the directory with its files.

AFAIK it is a bug.
Without even going to the stash command,
    git init
    echo 'X' >foo
    git add foo
    git commit -m "Adding foo"
    rm foo
    mkdir foo
    echo 'B' >foo/bar
    git status
At this point the state is incorrect, the file foo/bar isn't there, as
you mentionned.

>  $ git --version
> 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

Being at $daywork right now, I am unable to test this any further.

Thanks,
Rémi

  reply	other threads:[~2016-04-22 12:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-22 11:46 possible bug of git stash deleting uncommitted files in corner case Daniele Segato
2016-04-22 11:48 ` Daniele Segato
2016-04-22 12:29   ` Remi Galan Alfonso [this message]
2016-04-22 17:37     ` Junio C Hamano
2016-04-22 19:04       ` Remi Galan Alfonso
2016-04-23  3:53         ` Jeff King

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=1304154573.4013923.1461328186541.JavaMail.zimbra@ensimag.grenoble-inp.fr \
    --to=remi.galan-alfonso@ensimag.grenoble-inp.fr \
    --cc=daniele.segato@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
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).