* [Feature Request] git export
@ 2009-08-10 16:22 Thomas Koch
2009-08-10 16:27 ` Tim Visher
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Thomas Koch @ 2009-08-10 16:22 UTC (permalink / raw)
To: git
could you please provide a simple solution to save a tree object into an
arbitrary location?
I found some hints, that it would be possible by missusing either git
checkout-index or git-archive, but I think that it shouldn't require that much
GIT FU to do such a simple thing.
Thanks,
Thomas Koch, http://www.koch.ro
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Feature Request] git export
2009-08-10 16:22 [Feature Request] git export Thomas Koch
@ 2009-08-10 16:27 ` Tim Visher
2009-08-10 16:41 ` Thomas Koch
2009-08-10 16:54 ` Junio C Hamano
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Tim Visher @ 2009-08-10 16:27 UTC (permalink / raw)
To: thomas; +Cc: git
Hey Thomas,
On Mon, Aug 10, 2009 at 12:22 PM, Thomas Koch<thomas@koch.ro> wrote:
> could you please provide a simple solution to save a tree object into an
> arbitrary location?
This has been requested a few times and I have no idea what the
development status of it is. Most people seem to recommend just
making an alias around git checkout-index.
> I found some hints, that it would be possible by missusing either git
> checkout-index or git-archive, but I think that it shouldn't require that much
> GIT FU to do such a simple thing.
It's not really a misuse, as the [man page
itself](http://www.kernel.org/pub/software/scm/git/docs/git-checkout-index.html)
recommends using checkout-index as a way to export an entire tree.
Until someone decides that it's worth making the porcelain command
(like you perhaps) then I think you can just stick with checkout-index
knowing you're not abusing anything.
--
In Christ,
Timmy V.
http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Feature Request] git export
2009-08-10 16:27 ` Tim Visher
@ 2009-08-10 16:41 ` Thomas Koch
2009-08-10 18:31 ` Tim Visher
0 siblings, 1 reply; 7+ messages in thread
From: Thomas Koch @ 2009-08-10 16:41 UTC (permalink / raw)
To: Tim Visher; +Cc: git
Hi Tim,
thanks for your explanation. Still I don't get how to do it with git checkout-
index. The man page says "Just read the desired tree into the index", but I
don't know what is meant by this.
> Hey Thomas,
>
> On Mon, Aug 10, 2009 at 12:22 PM, Thomas Koch<thomas@koch.ro> wrote:
> > could you please provide a simple solution to save a tree object into an
> > arbitrary location?
>
> This has been requested a few times and I have no idea what the
> development status of it is. Most people seem to recommend just
> making an alias around git checkout-index.
>
> > I found some hints, that it would be possible by missusing either git
> > checkout-index or git-archive, but I think that it shouldn't require that
> > much GIT FU to do such a simple thing.
>
> It's not really a misuse, as the [man page
> itself](http://www.kernel.org/pub/software/scm/git/docs/git-checkout-index.
>html) recommends using checkout-index as a way to export an entire tree.
> Until someone decides that it's worth making the porcelain command (like
> you perhaps) then I think you can just stick with checkout-index knowing
> you're not abusing anything.
Thomas Koch, http://www.koch.ro
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Feature Request] git export
2009-08-10 16:22 [Feature Request] git export Thomas Koch
2009-08-10 16:27 ` Tim Visher
@ 2009-08-10 16:54 ` Junio C Hamano
2009-08-10 16:56 ` Johannes Schindelin
2009-08-11 7:50 ` Michael J Gruber
3 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2009-08-10 16:54 UTC (permalink / raw)
To: thomas; +Cc: git
Thomas Koch <thomas@koch.ro> writes:
> could you please provide a simple solution to save a tree object into an
> arbitrary location?
> I found some hints, that it would be possible by missusing either git
> checkout-index or git-archive, but I think that it shouldn't require that much
If you are talking about a tree object, then git-archive is what you want.
It was invented almost for this exact purpose, but unlike "export" that
would only copy to a directory, you can get a tarball out of it when you
do not want to expand the result into a directory; it is more versatile
form. The manual page for the command has an example (look for
"/var/tmp") so I won't repeat the cut-and-paste recipe here.
If you are not talking about a tree object but is talking about the
contents recorded in your index, checkout-index with the --prefix option
may be what you want. The manual page for the command has an example
(look for "--prefix=git-export-dir/") so I won't repeat it here.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Feature Request] git export
2009-08-10 16:22 [Feature Request] git export Thomas Koch
2009-08-10 16:27 ` Tim Visher
2009-08-10 16:54 ` Junio C Hamano
@ 2009-08-10 16:56 ` Johannes Schindelin
2009-08-11 7:50 ` Michael J Gruber
3 siblings, 0 replies; 7+ messages in thread
From: Johannes Schindelin @ 2009-08-10 16:56 UTC (permalink / raw)
To: Thomas Koch; +Cc: git
Hi,
On Mon, 10 Aug 2009, Thomas Koch wrote:
> could you please provide a simple solution to save a tree object into an
> arbitrary location?
>
> I found some hints, that it would be possible by missusing either git
> checkout-index or git-archive, but I think that it shouldn't require
> that much GIT FU to do such a simple thing.
You can check out Documentation/install-doc-quick.sh and find that
something like
GIT_INDEX_FILE=.git/tmp
export GIT_INDEX_FILE
git read-tree $TREE
git checkout-index -a -f --prefix=/the/path
unset GIT_INDEX_FILE
should work.
Hth,
Dscho
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Feature Request] git export
2009-08-10 16:41 ` Thomas Koch
@ 2009-08-10 18:31 ` Tim Visher
0 siblings, 0 replies; 7+ messages in thread
From: Tim Visher @ 2009-08-10 18:31 UTC (permalink / raw)
To: thomas; +Cc: git
On Mon, Aug 10, 2009 at 12:41 PM, Thomas Koch<thomas@koch.ro> wrote:
> thanks for your explanation. Still I don't get how to do it with git checkout-
> index. The man page says "Just read the desired tree into the index", but I
> don't know what is meant by this.
No problem. That phrase gave me some trouble the first time I read it
too. All it means is 'do a `git checkout` of the branch that you want
to export'. `git checkout-index` will then do an export of the
contents the branch that you currently have checked out.
Junio and Dscho's comments are possibly salient as well.
--
In Christ,
Timmy V.
http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Feature Request] git export
2009-08-10 16:22 [Feature Request] git export Thomas Koch
` (2 preceding siblings ...)
2009-08-10 16:56 ` Johannes Schindelin
@ 2009-08-11 7:50 ` Michael J Gruber
3 siblings, 0 replies; 7+ messages in thread
From: Michael J Gruber @ 2009-08-11 7:50 UTC (permalink / raw)
To: thomas; +Cc: git
Thomas Koch venit, vidit, dixit 10.08.2009 18:22:
> could you please provide a simple solution to save a tree object into an
> arbitrary location?
> I found some hints, that it would be possible by missusing either git
> checkout-index or git-archive, but I think that it shouldn't require that much
> GIT FU to do such a simple thing.
>
> Thanks,
>
> Thomas Koch, http://www.koch.ro
To serve you with an explicit command line, it's really only
git archive HEAD | tar -C wheretoexport/ -xf-
which you need to issue from within your git repo. Instead of HEAD, you
can use any "treeish", for example the name of a branch, which need not
be checked out. You can add path arguments after the treeish if you want
to export only parts of your repo.
Note that in true unix philosophy, git archive does the (git specific)
exporting only and leaves the importing into the file system (saving) to
the proper tool. I mean, would you rather use cp -r or pipes with tar
-x/tar -c or cpio -i/-o in order to copy a tree? ;)
Cheers,
Michael
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-08-11 12:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-10 16:22 [Feature Request] git export Thomas Koch
2009-08-10 16:27 ` Tim Visher
2009-08-10 16:41 ` Thomas Koch
2009-08-10 18:31 ` Tim Visher
2009-08-10 16:54 ` Junio C Hamano
2009-08-10 16:56 ` Johannes Schindelin
2009-08-11 7:50 ` Michael J Gruber
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).