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

Re: git-inject-tarball

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Dec 28, 2005, 11:42 UTC
Message-ID
<Pine.LNX.4.63.0512281230070.15184@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<pan.2005.12.28.02.40.14.577883@progsoc.org>
Hi,
On Wed, 28 Dec 2005, Anand Kumria wrote:
Show 7 quoted lines
> 
> Hi,
> 
> In the Everyday commands[1], there is an example of of extracting a
> tarball and then working with it.  I'm finding that I'm doing this fairly
> often -- I was just wondering if anyone had anything like a
> 'git-inject-tarball' script they'd written up.
Something like this?

-- snip -- #!/bin/sh

TARFILE="$1" test -z "$TARFILE" && TARFILE=-

git-ls-files -z | xargs -0 rm tar xvf "$TARFILE" | xargs git add git-update-index --remove $(git-ls-files) -- snap --

Notes:
	- this updates the index to match the given tarfile, you still 
	  have to commit yourself
	- it does not handle compressed tarfiles (you have to do something
	  like "cat bla.tar.gz | gzip -d | sh git-untar.sh")
	- it does not remove empty directories (i.e. if the current index 
	  contains a file "a/b", and the tarfile does not, and the
	  directory "a" is now empty, this is not handled)
	- usually, tarfiles contain files inside a subdirectory. There is
	  no facility to strip the subdirectory

Hth, Dscho

Previous: Anand KumriaNext: Simon Richter
Message 2 of 4 in “git-inject-tarball”
  1. Anand KumriaDec 28, 2005
  2. Johannes SchindelinDec 28, 2005
  3. Simon RichterDec 28, 2005
  4. Johannes SchindelinDec 28, 2005

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.