Subject: Re: Proposed git mv behavioral change

From: "Shawn O. Pearce" <[email-masked]>
Date: Thu, 18 Oct 2007 22:15:29 -0400

Michael Witten <[email-masked]> wrote:
> On 18 Oct 2007, at 9:57:15 PM, Shawn O. Pearce wrote:
> >Michael Witten <[email-masked]> 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.