From: "Shawn O. Pearce" <spearce@spearce.org>
To: Robin Rosenberg <robin.rosenberg@dewire.com>
Cc: git@vger.kernel.org
Subject: [JGIT PATCH 00/13] Add receive-pack server side support
Date: Mon, 22 Dec 2008 16:27:10 -0800 [thread overview]
Message-ID: <1229992043-1053-1-git-send-email-spearce@spearce.org> (raw)
This is a simple implementation of the receive-pack part of the
send-pack/receive-pack protocol used by push. Most of the logic
the server implements can be customized by implementing your
own PreReceiveHook implementation.
I'm actually going to use this within Gerrit 2 so users can push
into the special ref name "refs/changes/new" and have an anonymous
topic branch be created instead.
A basic "jgit daemon" for the git:// protocol is also included.
This daemon still has some major limitations over "git daemon":
- Only "receive-pack" is supported. We do not have a Java
version of "upload-pack" so we do not support it here.
- Virtual hosting is not supported; the "host=" header (if sent
by the client) is discarded.
- User escapes ("git://host/~user/foo.git") are not honored.
- No receive timeouts. Evil clients can connect and do nothing,
pinning the server thread indefinitely. This can cause the
server to consume resources until it crashes.
- No connection limits. Evil clients can DOS the server by just
opening a ton of connections.
- "jgit daemon" must be started within a git repository, even if
it won't publish that repository over the network. This is due
to a limitation in the way TextBuiltin initializes itself.
Providing "jgit receive-pack" should be trivial if the last item
is fixed, permitting jgit commands to be executed from outside of
a Git repository.
JSch does not have an SSH server implementation, so we cannot easily
provide an SSH daemon for our new push support. Apache MINA SSHD has
a nice daemon under development, and I plan on using it in Gerrit 2.
Perhaps someone will eventually contribute an extension library
for JGit which provides the binding glue necessary for MINA SSHD
to invoke JGit.
JGit's ReceivePack class does not invoke the standard hooks honored
by "git receive-pack", because doing so would require executing
an external process. There's enough data available in memory that
someone could easily contribute a PreReceiveHook and PostRecieveHook
implementation that honored these.
The early part of the series has some code cleanups to ensure we
are thread-safe, and to reduce the thrasing on the InflaterCache.
Shawn O. Pearce (13):
Fix invalid "double checked locking" in InflaterCache
Cleanup stupid release of the cached Inflater in IndexPack
Cache an Inflater inside a WindowCursor and reuse it as much as
possible
Make RefDatabase thread-safe
Make PackFile thread-safe
Make Repository thread-safe
Don't open a PackFile multiple times on scanForPacks
Expose RepositoryConfig.getBoolean so applications can use it
Add AnyObjectId.copyTo(StringBuilder)
Add compare-and-swap semantics to RefUpdate
Allow null new ObjectId during RefUpdate.delete
Implement the git-receive-pack process in Java
Add basic git daemon support to publish receive-pack
.../services/org.spearce.jgit.pgm.TextBuiltin | 1 +
.../src/org/spearce/jgit/pgm/Daemon.java | 125 +++
.../src/org/spearce/jgit/lib/AnyObjectId.java | 17 +-
.../jgit/lib/DeltaRefPackedObjectLoader.java | 2 +-
.../src/org/spearce/jgit/lib/InflaterCache.java | 31 +-
.../src/org/spearce/jgit/lib/PackFile.java | 14 +-
.../src/org/spearce/jgit/lib/RefDatabase.java | 29 +-
.../src/org/spearce/jgit/lib/RefUpdate.java | 32 +-
.../src/org/spearce/jgit/lib/Repository.java | 90 ++-
.../src/org/spearce/jgit/lib/RepositoryConfig.java | 4 +-
.../src/org/spearce/jgit/lib/WindowCursor.java | 33 +-
.../src/org/spearce/jgit/lib/WindowedFile.java | 17 +-
.../src/org/spearce/jgit/revwalk/RevWalk.java | 4 +-
.../src/org/spearce/jgit/transport/Daemon.java | 309 ++++++++
.../org/spearce/jgit/transport/DaemonClient.java | 106 +++
.../org/spearce/jgit/transport/DaemonService.java | 120 +++
.../src/org/spearce/jgit/transport/IndexPack.java | 17 +-
.../org/spearce/jgit/transport/PacketLineIn.java | 12 +
.../spearce/jgit/transport/PostReceiveHook.java | 77 ++
.../org/spearce/jgit/transport/PreReceiveHook.java | 94 +++
.../org/spearce/jgit/transport/ReceiveCommand.java | 223 ++++++
.../org/spearce/jgit/transport/ReceivePack.java | 793 ++++++++++++++++++++
.../spearce/jgit/transport/TransportGitAnon.java | 3 +-
23 files changed, 2060 insertions(+), 93 deletions(-)
create mode 100644 org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/Daemon.java
create mode 100644 org.spearce.jgit/src/org/spearce/jgit/transport/Daemon.java
create mode 100644 org.spearce.jgit/src/org/spearce/jgit/transport/DaemonClient.java
create mode 100644 org.spearce.jgit/src/org/spearce/jgit/transport/DaemonService.java
create mode 100644 org.spearce.jgit/src/org/spearce/jgit/transport/PostReceiveHook.java
create mode 100644 org.spearce.jgit/src/org/spearce/jgit/transport/PreReceiveHook.java
create mode 100644 org.spearce.jgit/src/org/spearce/jgit/transport/ReceiveCommand.java
create mode 100644 org.spearce.jgit/src/org/spearce/jgit/transport/ReceivePack.java
next reply other threads:[~2008-12-23 0:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-23 0:27 Shawn O. Pearce [this message]
2008-12-23 0:27 ` [JGIT PATCH 01/13] Fix invalid "double checked locking" in InflaterCache Shawn O. Pearce
2008-12-23 0:27 ` [JGIT PATCH 02/13] Cleanup stupid release of the cached Inflater in IndexPack Shawn O. Pearce
2008-12-23 0:27 ` [JGIT PATCH 03/13] Cache an Inflater inside a WindowCursor and reuse it as much as possible Shawn O. Pearce
2008-12-23 0:27 ` [JGIT PATCH 04/13] Make RefDatabase thread-safe Shawn O. Pearce
2008-12-23 0:27 ` [JGIT PATCH 05/13] Make PackFile thread-safe Shawn O. Pearce
2008-12-23 0:27 ` [JGIT PATCH 06/13] Make Repository thread-safe Shawn O. Pearce
2008-12-23 0:27 ` [JGIT PATCH 07/13] Don't open a PackFile multiple times on scanForPacks Shawn O. Pearce
2008-12-23 0:27 ` [JGIT PATCH 08/13] Expose RepositoryConfig.getBoolean so applications can use it Shawn O. Pearce
2008-12-23 0:27 ` [JGIT PATCH 09/13] Add AnyObjectId.copyTo(StringBuilder) Shawn O. Pearce
2008-12-23 0:27 ` [JGIT PATCH 10/13] Add compare-and-swap semantics to RefUpdate Shawn O. Pearce
2008-12-23 0:27 ` [JGIT PATCH 11/13] Allow null new ObjectId during RefUpdate.delete Shawn O. Pearce
2008-12-23 0:27 ` [JGIT PATCH 12/13] Implement the git-receive-pack process in Java Shawn O. Pearce
2008-12-23 0:27 ` [JGIT PATCH 13/13] Add basic git daemon support to publish receive-pack Shawn O. Pearce
2009-01-03 23:48 ` Robin Rosenberg
2009-01-05 2:46 ` [PATCH] Permit a wider range of repository names in jgit daemon requests Shawn O. Pearce
2009-01-05 23:07 ` Robin Rosenberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1229992043-1053-1-git-send-email-spearce@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=robin.rosenberg@dewire.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).