From: Junio C Hamano <hidden> Date: 2016-06-15 22:56:06
Junio C Hamano [off-list ref] 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" -
From: Robert Clausecker <hidden> Date: 2016-06-15 22:56:06
There are two things git archive is missing that are needed in my use
case:
First, git archive in combination with tar won't remove unneeded files.
You have to run rm -rf before manually which brings me to the next
point; git archive can't really make incremental updates. Consider an
export that overwrites a tree that resembles the state of an export two
commits before and contains a lot of files. I don't like to idea of
needing to remove all files and write all of them again just to change
one or two lines.
Perhaps my real problem is not "export" but rather "Can I have multiple
work trees with multiple checked out revisions?"...
Am Samstag, den 09.02.2013, 19:45 -0800 schrieb Junio C Hamano:
Junio C Hamano [off-list ref] writes:
quoted
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" -
From: Jonathan Nieder <hidden> Date: 2016-06-15 22:56:06
Hi Robert,
Robert Clausecker wrote:
There are two things git archive is missing that are needed in my use
case:
First, git archive in combination with tar won't remove unneeded files.
You have to run rm -rf before manually which brings me to the next
point; git archive can't really make incremental updates.
My advice is to keep a separate index file for your exported files.
Like this:
GIT_DIR=$(readlink -f $(git rev-parse --git-dir))
GIT_INDEX_FILE=$GIT_DIR/index-for-deployment
export GIT_DIR GIT_INDEX_FILE
cd $dest
git read-tree -m -u <tree>
Hope that helps,
Jonathan
From: Robert Clausecker <hidden> Date: 2016-06-15 22:56:06
That is actually a pretty interesting approach. I can use a different
index file for different deployments. How does this cooperate with bare
repositories? Aren't they supposed to have no index file at all?
Am Samstag, den 09.02.2013, 20:06 -0800 schrieb Jonathan Nieder:
My advice is to keep a separate index file for your exported files.
Like this:
GIT_DIR=$(readlink -f $(git rev-parse --git-dir))
GIT_INDEX_FILE=$GIT_DIR/index-for-deployment
export GIT_DIR GIT_INDEX_FILE
cd $dest
git read-tree -m -u <tree>
Hope that helps,
Jonathan
From: Jonathan Nieder <hidden> Date: 2016-06-15 22:56:06
Robert Clausecker wrote:
That is actually a pretty interesting approach. I can use a different
index file for different deployments. How does this cooperate with bare
repositories? Aren't they supposed to have no index file at all?
It should work fine in a bare repo.
If you can think of a good place to sneak hints about this into the
documentation (maybe as an example in git-archive(1) or a new
gitenvironment(7) page), that would be very welcome.
Thanks,
Jonathan