How to "git archive" using the Gerrit repo

2,463 views
Skip to first unread message

Robert Boehne

unread,
Jan 7, 2013, 12:20:03 PM1/7/13
to repo-d...@googlegroups.com
We're moving from CVS to Git with Gerrit.  In our organization, we have the need to install things
directory from the centralized revision control system, which we previously did with "cvs export".

Without Gerrit I would just do "git archive <args>  | tar -xf -

but Gerrit doesn't let me do this:

 git archive --remote=ssh://${USER}@review.trdlnk.com:29418/tradelink/automake master

Gerrit Code Review: git-upload-archive: not found
fatal: The remote end hung up unexpectedly

What can I do to to fix this?

Thanks,

Robert

Thomas Broyer

unread,
Jan 7, 2013, 12:32:51 PM1/7/13
to repo-d...@googlegroups.com
Workaround: If you can install gitweb (integrates nicely with Gerrit) then you can easily download snapshots in tar.gz archives.

Magnus Bäck

unread,
Jan 7, 2013, 12:40:36 PM1/7/13
to repo-d...@googlegroups.com
On Monday, January 07, 2013 at 12:20 EST,
Do you have to connect through Gerrit or could you make a "normal" SSH
connection and read the repository via C Git?

--
Magnus Bäck
ba...@google.com

Robert Boehne

unread,
Jan 7, 2013, 12:44:05 PM1/7/13
to repo-discuss
I wanted to avoid having users see the URL for accessing the git repo without going through the gerrit server and it's authentication.  Ideally we wouldn't allow ssh access to the git repo at all (aside from Gerrit).

After all, the fine-grained access control over the repositories was one of the primary reasons we went with Gerrit.

Thanks,

Rob


Robert Boehne

unread,
Jan 7, 2013, 12:47:33 PM1/7/13
to repo-d...@googlegroups.com

Is it possible to do this in a script so that I get the latest of a particular branch?  It looks like I have to specify a commit hash in the url.

Thomas Broyer

unread,
Jan 7, 2013, 5:41:22 PM1/7/13
to repo-d...@googlegroups.com


On Monday, January 7, 2013 6:47:33 PM UTC+1, Robert Boehne wrote:

Is it possible to do this in a script so that I get the latest of a particular branch?  It looks like I have to specify a commit hash in the url.

You can use any git ref has the 'h' URL parameter (e.g. h=refs%2Fheads%2Fmaster)

Shawn Pearce

unread,
Jan 7, 2013, 5:55:05 PM1/7/13
to Robert Boehne, repo-discuss
JGit does not support git archive, as it doesn't have the necessary
code (yet) to write tar or zip files from a commit SHA-1. Because of
that missing feature, the feature is also missing in Gerrit Code
Review. Work as started upstream in JGit to support git archive, but
it is still incomplete.

robert....@fxitech.com

unread,
Feb 5, 2014, 3:39:15 AM2/5/14
to repo-d...@googlegroups.com, Robert Boehne

JGit does not support git archive, as it doesn't have the necessary
code (yet) to write tar or zip files from a commit SHA-1. Because of
that missing feature, the feature is also missing in Gerrit Code
Review. Work as started upstream in JGit to support git archive, but
it is still incomplete.


It seems that some of the code in jgit is already ready for use:

 https://git.eclipse.org/r/#/c/12262/

Any plans for implementing that?

Thanks a lot
Best regards

Dave Borowitz

unread,
Feb 5, 2014, 2:38:30 PM2/5/14
to robert....@fxitech.com, repo-discuss, Robert Boehne
Yes, archive support is basically done upstream, but nobody has been motivated enough to add support to Gerrit. (For googlesource.com we just depend on the Gitiles repository browser for archive support, e.g. https://gerrit.googlesource.com/gerrit/+archive/master.tar.gz)


--
---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Doug Kelly

unread,
Feb 6, 2014, 2:57:33 PM2/6/14
to repo-d...@googlegroups.com, robert....@fxitech.com, Robert Boehne
On Wednesday, February 5, 2014 1:38:30 PM UTC-6, Dave Borowitz wrote:
Yes, archive support is basically done upstream, but nobody has been motivated enough to add support to Gerrit. (For googlesource.com we just depend on the Gitiles repository browser for archive support, e.g. https://gerrit.googlesource.com/gerrit/+archive/master.tar.gz)


Side note: Gitblit also provides archive support... although it will blow up with sufficiently large patches, I believe. 

Rob Ward

unread,
Feb 17, 2014, 2:20:44 PM2/17/14
to repo-d...@googlegroups.com
What changes are needed within gerrit to add support for git-archive now that this is available within jgit?

Has the required work been documented?

Cheers,
Rob

Shawn Pearce

unread,
Feb 17, 2014, 3:46:13 PM2/17/14
to Rob Ward, repo-discuss
On Mon, Feb 17, 2014 at 11:20 AM, Rob Ward
<robert....@googlemail.com> wrote:
> What changes are needed within gerrit to add support for git-archive now that this is available within jgit?

Gerrit would need a new servlet, similar to the one in Gitiles to
plumb the HTTP output stream onto the JGit archiver:

https://gerrit.googlesource.com/gitiles/+/HEAD/gitiles-servlet/src/main/java/com/google/gitiles/ArchiveServlet.java

The Gerrit specific parts are the authentication and authorization of
the request, that the caller is allowed to read the revision being
archived. Gitiles handles this inside its BaseServlet somewhere based
on the references found in the repository. Gerrit would need to do
something similar.

A different approach would be to install the gitiles plugin into
Gerrit. The authn/authz is already handled in the plugin glue.
Reply all
Reply to author
Forward
0 new messages