Subject: Re: Efficient way to import snapshots?

From: Craig Boston <[email-masked]>
Date: Mon, 30 Jul 2007 14:29:23 -0500

On Mon, Jul 30, 2007 at 11:56:56AM -0700, Linus Torvalds wrote:
> It should literally be as easy as doing something like
> 
> 	cd /path/to/cvs/checkout_X
> 	export GIT_DIR=/path/to/git/repo
> 	git add .
> 	git commit -m"Import yyyymmdd snapshot"

Aha!  I didn't know that you could point to a repository with GIT_DIR
and do useful operations without a working directory.  My "master" repo
that gets backed up and cloned everywhere is a bare repo anyway; I had
been cloning it with -s and then using 'git push' to get changes back
into it.

A couple questions on that:

1. Will it notice deleted files?
2. How can I tell it what branch to commit to?

> You'd have to make sure that you have the CVS directories ignored, of 
> course, and if you don't want to change the CVS directory at all (which is 
> a good idea!) you'd need to do that by using the "ignore" file in your 
> GIT_DIR, and just having the CVS entry there, instead of adding a
> ".gitignore" file to the working tree and checking it in.

Not a problem, I'm using cvsup in checkout mode so there are no CVS
dirs.  The checkout directory is an exact snapshot of "What The
Repository Should Look Like."

> The above is totally untested, of course, but I think that's the easiest 
> way to do things like this. In general, it should be *trivial* to do 
> snapshots with git using just about _any_ legacy SCM, exactly because you 
> can keep the whole git setup away from the legacy SCM directories with 
> that "GIT_DIR=.." thing. 

I'll make a backup of my repo and give it a try.

Thanks!

Craig