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

Re: Proposed git mv behavioral change

From
Shawn O. Pearce <spearce@spearce.org>
Date
Oct 19, 2007, 02:15 UTC
Message-ID
<20071019021529.GX14735@spearce.org>
In-Reply-To
<7F18F52A-3D57-4510-B71B-69D43480126E@MIT.EDU>
Michael Witten <mfwitten@MIT.EDU> wrote:
Show 11 quoted lines
> On 18 Oct 2007, at 9:57:15 PM, Shawn O. Pearce wrote:
> >Michael Witten <mfwitten@MIT.EDU> wrote:
> >>
> >>Seems like the shortcut would lose the history and confuse git.
> >
> >No.  It wouldn't.  The index has no knowledge of history of anything.
> 
> I mean to say, if only the index is changed,
> then git won't be informed about the necessary
> git-{add/rm}'s, as in the following (is this
> not so?):

git-add amounts to either inserting a new path->stat/sha1 entry in the index, or updating an existing entry with new stat/sha1 information.

git-rm amounts to removing a path->stat/sha1 entry from the index. It's just gone once the git-rm is completed. As if it was never there to begin with.

A git-commit (really git-write-tree but same difference to the end-user) stores whatever is in the index as the gospel truth for how that commit's files should appear. No knowledge about add or rm is necessary at this stage, we're just taking a copy of the index and recording that for posterity.

So updating the index is all that is necessary to "remember" these add and rm operations. OK, well, you also need to actually make a commit (and not orphan that commit) to have it really stay in your project. But its all really as simple as it seems.

-- 
Shawn.
Previous: Michael WittenNext: Jeff King
Message 5 of 34 in “Proposed git mv behavioral change”
  1. lmage11@twcny.rr.comOct 18, 2007
  2. Michael WittenOct 19, 2007
  3. Shawn O. PearceOct 19, 2007
  4. Michael WittenOct 19, 2007
  5. Shawn O. PearceOct 19, 2007
  6. Jeff KingOct 19, 2007
  7. Michael WittenOct 19, 2007
  8. Wincent ColaiutaOct 19, 2007
  9. Michael WittenOct 19, 2007
  10. Shawn O. PearceOct 19, 2007
  11. Michael WittenOct 19, 2007
  12. Shawn O. PearceOct 19, 2007
  13. Jeff KingOct 19, 2007
  14. Michael WittenOct 19, 2007
  15. Jeff KingOct 19, 2007
  16. Michael WittenOct 19, 2007
  17. Jeff KingOct 19, 2007
  18. Michael WittenOct 19, 2007
  19. Jeff KingOct 19, 2007
  20. Ari EntlichOct 20, 2007
  21. Jeff KingOct 20, 2007
  22. Michael WittenOct 20, 2007
  23. Jeff KingOct 20, 2007
  24. Shawn O. PearceOct 20, 2007
  25. Jeff KingOct 20, 2007
  26. Karl HasselströmOct 22, 2007
  27. Michael WittenOct 20, 2007
  28. Shawn O. PearceOct 20, 2007
  29. Wincent ColaiutaOct 20, 2007
  30. Karl HasselströmOct 22, 2007
  31. Ari EntlichOct 20, 2007
  32. Shawn O. PearceOct 20, 2007
  33. Mike HommeyOct 20, 2007
  34. Jeff KingOct 20, 2007

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.