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

Re: Reverting an uncommitted revert

From
Shawn O. Pearce <spearce@spearce.org>
Date
May 20, 2009, 14:17 UTC
Message-ID
<20090520141709.GO30527@spearce.org>
In-Reply-To
<alpine.LFD.2.00.0905200853010.3906@xanadu.home>
Nicolas Pitre <nico@cam.org> wrote:
Show 22 quoted lines
> On Wed, 20 May 2009, Wincent Colaiuta wrote:
> > El 20/5/2009, a las 5:35, Nicolas Pitre escribi?:
> > 
> > > Having a "trash" reflog would solve this unambiguously.  That could also
> > > include your index example above.  However, in the index case, I'd
> > > record a reflog entry only if you're about to discard a previously non
> > > committed entry.  If you do:
> > > 
> > > 	$ git add foo
> > > 	$ git add bar
> > > 	$ git commit
> > > 	$ hack hack hack
> > > 	$ git add foo
> > > 
> > > then in this case there is nothing to be lost hence no additional entry
> > > in the "trash" reflog.
> > 
> > That's true in the example you provide, but it doesn't really handle Jeff's
> > initial example ("git add" twice on the same file), where it is possible to
> > throw away intermediate state (by overwriting).
> 
> Did I disagree with Jeff's original example?

No, but if you don't read closely enough to notice that the first add affects path "foo" and the second add "bar", you might miss what you were trying to say. I almost thought you disagreed with Peff until I read your example a 2nd time. :-)

You did say "uncommitted entry causes reflog append", so in Peff's original example of "git add a; vi a; git add a", we should be creating a reflog entry for that first added state, which is clearly not a disagreement.

FWIW, I think this is a great idea, but lack the time to code it myself, otherwise I probably would start hacking on it right now.

-- 
Shawn.
Previous: Nicolas PitreNext: Eric Raible
Message 10 of 28 in “Reverting an uncommitted revert”
  1. Joshua JensenMay 20, 2009
  2. Nicolas PitreMay 20, 2009
  3. Jeff KingMay 20, 2009
  4. Nicolas PitreMay 20, 2009
  5. Jeff KingMay 20, 2009
  6. Ping YinMay 20, 2009
  7. Wincent ColaiutaMay 20, 2009
  8. Jakub NarebskiMay 20, 2009
  9. Nicolas PitreMay 20, 2009
  10. Shawn O. PearceMay 20, 2009
  11. Eric RaibleMay 20, 2009
  12. Junio C HamanoMay 20, 2009
  13. Nicolas PitreMay 20, 2009
  14. Nicolas PitreMay 20, 2009
  15. Shawn O. PearceMay 20, 2009
  16. Junio C HamanoMay 21, 2009
  17. Jakub NarebskiMay 20, 2009
  18. Wincent ColaiutaMay 20, 2009
  19. Nicolas PitreMay 20, 2009
  20. Sverre RabbelierMay 20, 2009
  21. Jeff KingMay 20, 2009
  22. Nicolas PitreMay 20, 2009
  23. Sverre RabbelierMay 20, 2009
  24. Jeff KingMay 21, 2009
  25. Junio C HamanoMay 20, 2009
  26. write-tree --ignore-cache-treeJunio C Hamano, May 20, 2009
  27. 1/2 cache-tree.c::cache_tree_find(): simplify inernal APIJunio C Hamano, May 21, 2009
  28. 2/2 Optimize "diff-index --cached" using cache-treeJunio C Hamano, May 21, 2009

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.