Re: Fixing Commit And Author

From: Linus Torvalds <torvalds@osdl.org>
Date: 2005-11-05 04:30:50
On Fri, 4 Nov 2005, Darrin Thompson wrote:

> I've got a small project in git where I made a dumb error. All my
> commits have author/committer information like this:
> 
> Author: Darrin Thompson <darrint@dhcp-1-211.(none)>  2005-10-20 16:50:38
> Committer: Darrin Thompson <darrint@dhcp-1-211.(none)>  2005-10-20
> 16:50:38
> Tags: svn-5099
> 
> I'd like to replace the commits (yes, I know that means all of them)
> with new ones with corrected email addresses and also manage to migrate
> my tags. A push in the right direction would be appreciated.

There's a program in the git sources called "git-convert-objects.c".

It basically knows how to walk the git object chains, and rewrite each 
object according to a few rules.

The rules currently do _not_ include changing the author/committer info, 
but it does know how to parse the really old-style dates, for example, 
which are on those same lines, so adding some code there to also re-write 
the author/committer name and email wouldn't be impossible.

The code isn't necessarily all that easy to understand, and usage-wise you 
also have to convert each head separately (you tell it which branch head 
you want to convert, it trawls every reachable object from that head, and 
will create the new objects and return the new head value).

What I'm trying to say is that it might not be _pleasant_, but it's 
certainly something you can automate and do in a timely manner (ie a small 
project will take just a few seconds - or minutes - to convert).

> Next I'd like to do the same with the kernel sources... :-)

The same program will work, but it will take some time.

Actually, as long as you only rewrite commits, it should even be 
reasonably efficient. It's when you start rewriting every single object 
(like I did when I switched the compression scheme around) that it gets 
_really_ expensive, and a project like the kernel would take a long long 
time.

Hint to the wise: don't do the conversion on the only copy of the 
repository you have. It's always worked for me, but hey, maybe I'm just 
lucky and never write buggy conversion software.

			Linus
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Sat Nov 05 04:31:29 2005

This archive was generated by hypermail 2.1.8 : 2005-11-05 04:31:33 EST