git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Horst H. von Brand <vonbrand@inf.utfsm.cl>
Date
Jan 12, 2007, 14:09 UTC
Message-ID
<200701121409.l0CE9923015123@laptop13.inf.utfsm.cl>
In-Reply-To
<riddochc@gmail.com>
Chris Riddoch <riddochc@gmail.com> wrote:
Show 15 quoted lines
> 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
Next: Johannes Sixt
Message 1 of 2 in “Re: Importing from tarballs; add, rm, update-index?”
  1. Horst H. von BrandJan 12, 2007
  2. Johannes SixtJan 12, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.