From: "Shawn O. Pearce" <spearce@spearce.org>
To: Vagmi Mudumbai <vagmi.mudumbai@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: JGit vs. Git
Date: Tue, 6 Jan 2009 10:45:23 -0800 [thread overview]
Message-ID: <20090106184523.GA24578@spearce.org> (raw)
In-Reply-To: <a55cfe9d0901052250k2be203dfvb0b437a523f2cecc@mail.gmail.com>
Vagmi Mudumbai <vagmi.mudumbai@gmail.com> wrote:
> 1) Is JGit a drop in replacement of Git? In sense, if I were to pack
> in an SCM with my app, Can I pack jgit instead of C Git?
As Robin said, its not a full drop-in replacement. That said, its
getting there. We're now only really missing patch application,
diff generation, merge support, and submodule support. Most of
the JGit core can handle submodules by skipping over them during
object traversal, but the part that talks to the filesystem to do
a checkout doesn't recognize them.
JGit is mostly a library, not a command line replacement. But it
does have commands like "jgit init", "jgit clone", "jgit fetch",
"jgit push", even some server side tools like "jgit daemon",
"jgit receive-pack" and "jgit upload-pack".
To be honest I don't think anyone actually uses the command line
pgm stuff to work with Git. Anyone using JGit is actually running
it embedded in some type of application like an IDE plugin or a
server like Gerrit.
> 2) I noticed that there are no 'add' and 'commit' commands (at least
> from the source) in the org.spearce.git.pgm project. I am looking at
> the repo.or.cz/egit.git repo. I had a brief look at the
> lib/GitIndex.java and lib/Repository.java. GitIndex has the add
> methods to add files/entries to the index. I am still stumped on how
> commits can be done with JGit. Any help is hugely appreciated.
As Robin said, look at the unit tests. Basically you want to use
the Commit class to populate out the data fields, then pass it off to
an ObjectWriter instance to store it into the tree. Finally you'll
need to use a RefUpdate (obtained from Repository's updateRef method)
to store the new ObjectId of that Commit into a ref like HEAD.
Unfortunately we have two commit representations in JGit. If you
are trying to read data from a Repository the RevCommit (obtained
from a RevWalk) is orders of magnitude faster than the Commit class.
> I am working on Windows with msysGit behind a HTTP Proxy. (Life cant
> get worse, I guess.) . I planned on using grit via JRuby but grit uses
> fork which is not available on funny platforms like windows. And JRuby
> guys do not have any plan on supporting fork even on platforms on
> which for is supported. If JGit is a pure Java based implementation of
> Git with more or less the same functionality, then my work becomes a
> lot easier.
I plan on writing patch apply sometime this quarter I think. I have
most of what I need to rip a patch apart and inspect it prior to
application, now I just need to line it up onto the base object
and issue the output version.
Diff might also come in the next few months. Dscho has a nice
prototype working, but there's still some work to be done on it.
--
Shawn.
next prev parent reply other threads:[~2009-01-06 18:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <a55cfe9d0901052249v1461c70cp1d89e184cfc05eb9@mail.gmail.com>
2009-01-06 6:50 ` JGit vs. Git Vagmi Mudumbai
2009-01-06 11:12 ` Robin Rosenberg
2009-01-06 19:55 ` Stephen Bannasch
2009-01-06 18:45 ` Shawn O. Pearce [this message]
2009-01-06 21:41 ` Johannes Schindelin
2009-01-07 5:08 ` Vagmi Mudumbai
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=20090106184523.GA24578@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=vagmi.mudumbai@gmail.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).