Re: Feature request: Allow extracting revisions into directories
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 10, 2013, 03:45 UTC
- Message-ID
- <7vpq08u903.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <7vehgpum7n.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> I am not Phil, but if you ask me, I think it is borderline between > "meh" and "no way we would give a short-and-sweet -i to something > like this".
I think one reason it was "meh" for me is that we never did an equivalent of "cvs export" and "svn export", primarily because we had "tar-tree" (aka "archive --format=tar") first, and it was sufficient to pipe its outputto "tar xf -" if somebody wanted to do the non-existent "git export". Also "tar-tree" was more useful for people who wanted to eventually want to have a tarball (you can first "export" and then "tar cf" the resulting directory).
But I think it is fine to add "git export <revision> <directory>", which may look like this, perhaps.
#!/bin/sh
# git export <rev> <directory>
rev=${1?revision} dir=${2?directory}
. $(git --exec-path)/git-sh-setup mkdir -p "$dir" || exit
git archive --format=tar "$rev" |
tar Cxf "$dir" -