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.