# Re: Importing from tarballs; add, rm, update-index?

2 messages from 2007-01-12 to 2007-01-12. Participants: Horst H. von Brand, Johannes Sixt.
Thread: https://gitlist.dev/t/6354

## Horst H. von Brand, 2007-01-12 14:09

Subject: Re: Importing from tarballs; add, rm, update-index?
Message-ID: <200701121409.l0CE9923015123@laptop13.inf.utfsm.cl>
URL: https://gitlist.dev/e/200701121409.l0CE9923015123%40laptop13.inf.utfsm.cl
In-Reply-To: <riddochc@gmail.com>

```
Chris Riddoch <riddochc@gmail.com> 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

```

## Johannes Sixt, 2007-01-12 14:39

Subject: Re: Importing from tarballs; add, rm, update-index?
Message-ID: <45A79DBC.1795F5C4@eudaptics.com>
URL: https://gitlist.dev/e/45A79DBC.1795F5C4%40eudaptics.com
In-Reply-To: <200701121409.l0CE9923015123@laptop13.inf.utfsm.cl>

```
"Horst H. von Brand" wrote:
> 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

You can let GIT_DIR point somewhere outside the extracted directory.

If the dates of your tarballs are meaningful, you can use something like
this:

export GIT_AUTHOR_DATE="$(date --reference=foo-1.1.tar +%s) -07:00"

   
-- Hannes

```
