Re: Importing from tarballs; add, rm, update-index?
From: Horst H. von Brand <hidden>
Date: 2016-06-15 22:42:49
Chris Riddoch [off-list ref] wrote:
I've got a very, very old codebase I'm trying to wrap my head around. It was apparently once tracked with RCS, but the ,v files are long gone and all that remains are a series of tarballs on an FTP site containing alpha, beta, and final releases of various versions of the project. There's a logical progression, but between each there are new files, deleted files, and lots of changed files. gitk will at least help me make sense of the actual changes. I've got part of a shell script to automate this process. Here's the problem. I have tried to follow the debate on git add, rm, commit -a, etc. But I can't figure out how to simply say, take the full state of the working directory, and make the index directly reflect that state. Additions, removals, and differences alike. One step, preferably.
Hum... something like the following (completely untested!) should do the
trick:
cd /basedir
mkdir codebase; cd codebase; git init-db
for version in 1.0 1.1 1.1a 1.1b 2.0.0 ...; do
cd /basedir
tar xf tarball-$version.tar
mv codebase-$version/* codebase # Take care to move everything!
cd codebase
git add .
git commit -a -m "Updated to $version"
rm -rf * # Delete everything except for git stuff
done
Files that don't change will be recorded as is (git tracks contents).
Comments?
--
Dr. Horst H. von Brand User #22616 counter.li.org
Departamento de Informatica Fono: +56 32 2654431
Universidad Tecnica Federico Santa Maria +56 32 2654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 2797513