git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Aleksandr Pryimak <tramsmm-mirror@yandex.ru>, git@vger.kernel.org
Subject: Re: git stash data loss
Date: Thu, 16 Aug 2012 20:30:48 -0700	[thread overview]
Message-ID: <7vy5lew5xz.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20120727135051.GA10303@sigill.intra.peff.net> (Jeff King's message of "Fri, 27 Jul 2012 09:50:51 -0400")

Jeff King <peff@peff.net> writes:

> On Fri, Jul 27, 2012 at 09:29:53AM -0400, Jeff King wrote:
>
>> If we put actual files inside "x", which git does track, then they would
>> be part of the stash, and should be properly retained. But they're not:
>> 
>>   $ rm x && mkdir x && echo foo >x/file
>> 
>> Now we have some precious contents in the form of "x/file". They are
>> untracked by git, but git should be careful about removing them.
>> 
>>   $ git stash
>>   Saved working directory and index state WIP on master: 2d32d3a initial
>>   HEAD is now at 2d32d3a initial
>>   $ ls -l x
>>   -rw-r--r-- 1 peff peff 0 Jul 27 09:19 x
>>   $ git stash show --raw
>>   :100644 000000 e69de29... 0000000... D  x
>> 
>> Now this _is_ data loss. Stash blows away untracked files inside the
>> directory, but does not record them in the resulting stash. And that
>> should be fixed.
>
> Hrm. The problem is that after creating the stash, we then run "git
> reset --hard" to drop the changes that we just stashed. But that is not
> always accurate. It will not usually touch untracked files, but it might
> if they have D/F conflicts with tracked files. So we need to replace
> that "git reset --hard" with some safer command that will notice we are
> about to overwrite untracked files. But I am not sure what that command
> would be.

Is this something we still want to keep track of?

As readers can probably guess, I am trying to come up with a list of
loose ends for the next cycle.  This may be one of the low-hanging
ones.

  reply	other threads:[~2012-08-17  3:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-27  3:06 git stash data loss Aleksandr Pryimak
2012-07-27 13:29 ` Jeff King
2012-07-27 13:50   ` Jeff King
2012-08-17  3:30     ` Junio C Hamano [this message]
2012-08-21  6:55       ` Jeff King
2012-09-14 23:04         ` Junio C Hamano
2012-07-27 14:21   ` Aleksandr Priymak

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=7vy5lew5xz.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=tramsmm-mirror@yandex.ru \
    /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).