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

Re: [PATCH 2/2] (resend) stash: Don't overwrite files that have gone from the index

From
Jeff King <peff@peff.net>
Date
Apr 15, 2010, 07:38 UTC
Message-ID
<20100415073856.GC27542@coredump.intra.peff.net>
In-Reply-To
<201004150933.41330.trast@student.ethz.ch>
On Thu, Apr 15, 2010 at 09:33:40AM +0200, Thomas Rast wrote:
Show 18 quoted lines
> Charles Bailey wrote:
> > diff --git a/git-stash.sh b/git-stash.sh
> > index 908aab2..9efc544 100755
> > --- a/git-stash.sh
> > +++ b/git-stash.sh
> > @@ -87,6 +87,8 @@ create_stash () {
> >  			export GIT_INDEX_FILE &&
> >  			git read-tree -m $i_tree &&
> >  			git add -u &&
> > +			{ git diff --quiet --diff-filter=D --cached ||
> > +				git diff -z --name-only --diff-filter=D --cached | xargs -0 git add --ignore-errors; } &&
> 
> I think you'll also have to turn it into an 'add -f' invocation since
> the file in question could conceivably have been ignored-but-tracked,
> and straight 'add' would refuse to re-track it.
> 
> (No, I don't have any good ideas on how to get rid of xargs short of
> some shell loop...)

It should probably use update-index, which has a --stdin mode, and which doesn't care about ignores.

-Peff
PS I have not looked carefully into this issue yet, so I don't know if
   the patch actually does the right thing or not.
Previous: Thomas Rast
Message 4 of 4 in “(resend) stash bug: stash can lose data in a file removed from the index”
  1. 1/2 (resend) stash bug: stash can lose data in a file removed from the indexCharles Bailey, Apr 15, 2010
  2. 2/2 (resend) stash: Don't overwrite files that have gone from the indexCharles Bailey, Apr 15, 2010
  3. Thomas RastApr 15, 2010
  4. Jeff KingApr 15, 2010

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.