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: Junio C Hamano <gitster@pobox.com>
Cc: Daniele Segato <daniele.segato@gmail.com>, git@vger.kernel.org
Subject: Re: possible bug of git stash deleting uncommitted files in corner case
Date: Fri, 22 Apr 2016 21:04:25 +0200 (CEST)	[thread overview]
Message-ID: <754076461.4029096.1461351865455.JavaMail.zimbra@ensimag.grenoble-inp.fr> (raw)
In-Reply-To: <xmqqmvolpmsw.fsf@gitster.mtv.corp.google.com>

Junio C Hamano <gitster@pobox.com> writes:
> 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

  reply	other threads:[~2016-04-22 18:58 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
2016-04-22 17:37     ` Junio C Hamano
2016-04-22 19:04       ` Remi Galan Alfonso [this message]
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=754076461.4029096.1461351865455.JavaMail.zimbra@ensimag.grenoble-inp.fr \
    --to=remi.galan-alfonso@ensimag.grenoble-inp.fr \
    --cc=daniele.segato@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
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).