{"thread":{"id":"2939","subject":"git-inject-tarball","startedAt":"2005-12-28T02:40:15Z","lastAt":"2005-12-28T16:18:30Z","messageCount":4,"participants":["Anand Kumria","Johannes Schindelin","Simon Richter"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"14083","messageId":"pan.2005.12.28.02.40.14.577883@progsoc.org","threadId":"2939","inReplyTo":null,"subject":"git-inject-tarball","fromName":"Anand Kumria","fromEmail":"wildfire@progsoc.org","sentAt":"2005-12-28T02:40:15Z","receivedAt":"2005-12-28T02:40:15Z","isPatch":false,"sender":{"key":"wildfire@progsoc.org","avatar":null},"body":"\nHi,\n\nIn the Everyday commands[1], there is an example of of extracting a\ntarball and then working with it.  I'm finding that I'm doing this fairly\noften -- I was just wondering if anyone had anything like a\n'git-inject-tarball' script they'd written up.\n\nThanks,\nAnand\n\n[1]: http://www.kernel.org/pub/software/scm/git/docs/everyday.html\n"},{"id":"14086","messageId":"Pine.LNX.4.63.0512281230070.15184@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2939","inReplyTo":"pan.2005.12.28.02.40.14.577883@progsoc.org","subject":"Re: git-inject-tarball","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-12-28T11:42:26Z","receivedAt":"2005-12-28T11:42:26Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 28 Dec 2005, Anand Kumria wrote:\n\n> \n> Hi,\n> \n> In the Everyday commands[1], there is an example of of extracting a\n> tarball and then working with it.  I'm finding that I'm doing this fairly\n> often -- I was just wondering if anyone had anything like a\n> 'git-inject-tarball' script they'd written up.\n\nSomething like this?\n\n-- snip --\n#!/bin/sh\n\nTARFILE=\"$1\"\ntest -z \"$TARFILE\" && TARFILE=-\n\ngit-ls-files -z | xargs -0 rm\ntar xvf \"$TARFILE\" | xargs git add\ngit-update-index --remove $(git-ls-files)\n-- snap --\n\nNotes:\n\t- this updates the index to match the given tarfile, you still \n\t  have to commit yourself\n\t- it does not handle compressed tarfiles (you have to do something\n\t  like \"cat bla.tar.gz | gzip -d | sh git-untar.sh\")\n\t- it does not remove empty directories (i.e. if the current index \n\t  contains a file \"a/b\", and the tarfile does not, and the\n\t  directory \"a\" is now empty, this is not handled)\n\t- usually, tarfiles contain files inside a subdirectory. There is\n\t  no facility to strip the subdirectory\n\nHth,\nDscho\n"},{"id":"14087","messageId":"43B2B474.1000603@hogyros.de","threadId":"2939","inReplyTo":"Pine.LNX.4.63.0512281230070.15184@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: git-inject-tarball","fromName":"Simon Richter","fromEmail":"simon.richter@hogyros.de","sentAt":"2005-12-28T15:51:16Z","receivedAt":"2005-12-28T15:51:16Z","isPatch":false,"sender":{"key":"simon.richter@hogyros.de","avatar":"https://gravatar.com/avatar/1192aa9fa5dd19ce258b12b044cc27111dd7cdb58d920dc2123a02a24f55b5c5?d=mp&s=160"},"body":"Hi,\n\nJohannes Schindelin wrote:\n\n> Something like this?\n\n> -- snip --\n> #!/bin/sh\n> \n> TARFILE=\"$1\"\n> test -z \"$TARFILE\" && TARFILE=-\n> \n> git-ls-files -z | xargs -0 rm\n> tar xvf \"$TARFILE\" | xargs git add\n> git-update-index --remove $(git-ls-files)\n> -- snap --\n\nWell, the most important thing for such a tool IMO would be that it \nwouldn't overwrite any uncommitted changes, so it's not as trivial as it \nseems.\n\n    Simon\n"},{"id":"14089","messageId":"Pine.LNX.4.63.0512281717040.28473@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2939","inReplyTo":"43B2B474.1000603@hogyros.de","subject":"Re: git-inject-tarball","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-12-28T16:18:30Z","receivedAt":"2005-12-28T16:18:30Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 28 Dec 2005, Simon Richter wrote:\n\n> Well, the most important thing for such a tool IMO would be that it wouldn't\n> overwrite any uncommitted changes, so it's not as trivial as it seems.\n\nAh, but that's easy:\n\n\ttest -z \"$(git-diff-index --name-only HEAD)\" || exit 1\n\n(This is just the idea; you should also output an error message.)\n\nHth,\nDscho\n"}]}