{"thread":{"id":"17017","subject":"JGit vs. Git","startedAt":"2009-01-06T06:50:11Z","lastAt":"2009-01-07T05:08:10Z","messageCount":6,"participants":["Vagmi Mudumbai","Robin Rosenberg","Shawn O. Pearce","Stephen Bannasch","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"99424","messageId":"a55cfe9d0901052250k2be203dfvb0b437a523f2cecc@mail.gmail.com","threadId":"17017","inReplyTo":"a55cfe9d0901052249v1461c70cp1d89e184cfc05eb9@mail.gmail.com","subject":"JGit vs. Git","fromName":"Vagmi Mudumbai","fromEmail":"vagmi.mudumbai@gmail.com","sentAt":"2009-01-06T06:50:11Z","receivedAt":"2009-01-06T06:50:11Z","isPatch":false,"sender":{"key":"vagmi.mudumbai@gmail.com","avatar":null},"body":"Hi,\n\nI am a git and a jgit noob. Be gentle. :-)\n\n1) Is JGit a drop in replacement of Git? In sense, if I were to pack\nin an SCM with my app, Can I pack jgit instead of C Git?\n\n2) I noticed that there are no 'add' and 'commit' commands (at least\nfrom the source) in the org.spearce.git.pgm project. I am looking at\nthe repo.or.cz/egit.git repo. I had a brief look at the\nlib/GitIndex.java and lib/Repository.java. GitIndex has the add\nmethods to add files/entries to the index. I am still stumped on how\ncommits can be done with JGit. Any help is hugely appreciated.\n\nI am working on Windows with msysGit behind a HTTP Proxy. (Life cant\nget worse, I guess.) . I planned on using grit via JRuby but grit uses\nfork which is not available on funny platforms like windows. And JRuby\nguys do not have any plan on supporting fork even on platforms on\nwhich for is supported. If JGit is a pure Java based implementation of\nGit with more or less the same functionality, then my work becomes a\nlot easier.\n\nRegards,\nVagmi\n"},{"id":"99460","messageId":"200901061212.07240.robin.rosenberg.lists@dewire.com","threadId":"17017","inReplyTo":"a55cfe9d0901052250k2be203dfvb0b437a523f2cecc@mail.gmail.com","subject":"Re: JGit vs. Git","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2009-01-06T11:12:07Z","receivedAt":"2009-01-06T11:12:07Z","isPatch":false,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"tisdag 06 januari 2009 07:50:11 skrev Vagmi Mudumbai:\n> Hi,\n> \n> I am a git and a jgit noob. Be gentle. :-)\n> \n> 1) Is JGit a drop in replacement of Git? In sense, if I were to pack\n> in an SCM with my app, Can I pack jgit instead of C Git?\nShort answer: No. JGit is a library for implementing access to a Git\nrepository. It does not have nearly all functionality and the command\nline interface is mostly for testing the internals and so it only has\nwhat's needed for that purpose or because we like to. The command\nset will become more complete over time.\n> \n> 2) I noticed that there are no 'add' and 'commit' commands (at least\n> from the source) in the org.spearce.git.pgm project. I am looking at\n> the repo.or.cz/egit.git repo. I had a brief look at the\n> lib/GitIndex.java and lib/Repository.java. GitIndex has the add\n> methods to add files/entries to the index. I am still stumped on how\n> commits can be done with JGit. Any help is hugely appreciated.\n\nWith the Eclipse plugin. If you want to implement the add and commit\ncommands, please do. You won't need much code for it. The class that\ndoes adding in Eclipse is called Track, btw. You can also take a look at\nunit tests for how to do things and the other commands for how to\nwrite commands. It's very easy actually. Then submit your patch.\n\nWhat is most apparently missing from the internals is handling patches.\nWe have patch reading (but not application), now, plus candidate for\ncreating diffs (it works, but needs to be libified, byte[]-ified and we want\nto make it faster).\n\n> I am working on Windows with msysGit behind a HTTP Proxy. (Life cant\n> get worse, I guess.) . I planned on using grit via JRuby but grit uses\n> fork which is not available on funny platforms like windows. And JRuby\n> guys do not have any plan on supporting fork even on platforms on\n> which for is supported. If JGit is a pure Java based implementation of\nfork isn't really supported on Windows. Cygwin goes to great lengths to\nemulate it. Trying to do that within the context of an arbitrary JVM seems\nlike a daunting task. Consider submitting patches to make grit not use fork...\njust kidding.., please help us improve JGit instead :)\n\n> Git with more or less the same functionality, then my work becomes a\n> lot easier.\n\nThe intention is to be able to do anything useful with JGit too.\n\n-- robin\n"},{"id":"99488","messageId":"20090106184523.GA24578@spearce.org","threadId":"17017","inReplyTo":"a55cfe9d0901052250k2be203dfvb0b437a523f2cecc@mail.gmail.com","subject":"Re: JGit vs. Git","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-01-06T18:45:23Z","receivedAt":"2009-01-06T18:45:23Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Vagmi Mudumbai <vagmi.mudumbai@gmail.com> wrote:\n> 1) Is JGit a drop in replacement of Git? In sense, if I were to pack\n> in an SCM with my app, Can I pack jgit instead of C Git?\n\nAs Robin said, its not a full drop-in replacement.  That said, its\ngetting there.  We're now only really missing patch application,\ndiff generation, merge support, and submodule support.  Most of\nthe JGit core can handle submodules by skipping over them during\nobject traversal, but the part that talks to the filesystem to do\na checkout doesn't recognize them.\n\nJGit is mostly a library, not a command line replacement.  But it\ndoes have commands like \"jgit init\", \"jgit clone\", \"jgit fetch\",\n\"jgit push\", even some server side tools like \"jgit daemon\",\n\"jgit receive-pack\" and \"jgit upload-pack\".\n\nTo be honest I don't think anyone actually uses the command line\npgm stuff to work with Git.  Anyone using JGit is actually running\nit embedded in some type of application like an IDE plugin or a\nserver like Gerrit.\n \n> 2) I noticed that there are no 'add' and 'commit' commands (at least\n> from the source) in the org.spearce.git.pgm project. I am looking at\n> the repo.or.cz/egit.git repo. I had a brief look at the\n> lib/GitIndex.java and lib/Repository.java. GitIndex has the add\n> methods to add files/entries to the index. I am still stumped on how\n> commits can be done with JGit. Any help is hugely appreciated.\n\nAs Robin said, look at the unit tests.  Basically you want to use\nthe Commit class to populate out the data fields, then pass it off to\nan ObjectWriter instance to store it into the tree.  Finally you'll\nneed to use a RefUpdate (obtained from Repository's updateRef method)\nto store the new ObjectId of that Commit into a ref like HEAD.\n\nUnfortunately we have two commit representations in JGit.  If you\nare trying to read data from a Repository the RevCommit (obtained\nfrom a RevWalk) is orders of magnitude faster than the Commit class.\n\n> I am working on Windows with msysGit behind a HTTP Proxy. (Life cant\n> get worse, I guess.) . I planned on using grit via JRuby but grit uses\n> fork which is not available on funny platforms like windows. And JRuby\n> guys do not have any plan on supporting fork even on platforms on\n> which for is supported. If JGit is a pure Java based implementation of\n> Git with more or less the same functionality, then my work becomes a\n> lot easier.\n\nI plan on writing patch apply sometime this quarter I think.  I have\nmost of what I need to rip a patch apart and inspect it prior to\napplication, now I just need to line it up onto the base object\nand issue the output version.\n\nDiff might also come in the next few months.  Dscho has a nice\nprototype working, but there's still some work to be done on it.\n\n-- \nShawn.\n"},{"id":"99500","messageId":"p06240805c589657fd75a@[192.168.1.114]","threadId":"17017","inReplyTo":"200901061212.07240.robin.rosenberg.lists@dewire.com","subject":"Re: JGit vs. Git","fromName":"Stephen Bannasch","fromEmail":"stephen.bannasch@deanbrook.org","sentAt":"2009-01-06T19:55:39Z","receivedAt":"2009-01-06T19:55:39Z","isPatch":false,"sender":{"key":"stephen.bannasch@deanbrook.org","avatar":null},"body":"At 12:12 PM +0100 1/6/09, Robin Rosenberg wrote:\n>tisdag 06 januari 2009 07:50:11 skrev Vagmi Mudumbai:\n>  > I am working on Windows with msysGit behind a HTTP Proxy. (Life cant\n>>  get worse, I guess.) . I planned on using grit via JRuby but grit uses\n>>  fork which is not available on funny platforms like windows. And JRuby\n>>  guys do not have any plan on supporting fork even on platforms on\n>>  which for is supported. If JGit is a pure Java based implementation of\n>fork isn't really supported on Windows. Cygwin goes to great lengths to\n>emulate it. Trying to do that within the context of an arbitrary JVM seems\n>like a daunting task. Consider submitting patches to make grit not use fork...\n>just kidding.., please help us improve JGit instead :)\n\nOr think about extending the Ruby gem grit to also use JGit.  Which \nwould certainly improve grit and  probably help improve JGit also.\n\nI've thought about this a bit -- but it hasn't gotten to the top of \nmy list yet ...\n\nThere are some examples of Ruby Gems which use Java libraries when \nrun in JRuby and native C libraries when used from MRI.\n\n   hpricot:   http://github.com/why/hpricot/tree\n   redcloth:  http://github.com/jgarber/redcloth/tree/master\n"},{"id":"99512","messageId":"alpine.DEB.1.00.0901062240240.30769@pacific.mpi-cbg.de","threadId":"17017","inReplyTo":"a55cfe9d0901052250k2be203dfvb0b437a523f2cecc@mail.gmail.com","subject":"Re: JGit vs. Git","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-06T21:41:52Z","receivedAt":"2009-01-06T21:41:52Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 6 Jan 2009, Vagmi Mudumbai wrote:\n\n> I am working on Windows with msysGit behind a HTTP Proxy. (Life cant\n> get worse, I guess.) .\n\nFWIW I think all should work well if you use a proxy, such as \nhttp://www.meadowy.org/~gotoh/projects/connect\n\nHth,\nDscho\n"},{"id":"99541","messageId":"a55cfe9d0901062108m7c6a5133o59ee955bba3ab018@mail.gmail.com","threadId":"17017","inReplyTo":"alpine.DEB.1.00.0901062240240.30769@pacific.mpi-cbg.de","subject":"Re: JGit vs. Git","fromName":"Vagmi Mudumbai","fromEmail":"vagmi.mudumbai@gmail.com","sentAt":"2009-01-07T05:08:10Z","receivedAt":"2009-01-07T05:08:10Z","isPatch":false,"sender":{"key":"vagmi.mudumbai@gmail.com","avatar":null},"body":"Hi,\n\n@Stephen\n>> Or think about extending the Ruby gem grit to also use JGit.  Which would certainly improve grit and  probably help improve JGit also.\nI just started working on that. It will be close to Grit let me see\nhow far I get with it. If you have an existing repo that you have\nalready worked on, please feel free to share it.\n\nThe JGit code both tests and the UI is quite readable.\n\nThanks a ton for all your help. :-)\n\nRegards,\nVagmi\n\nhttp://blog.vagmim.com\n\"Teaching children to use Windows is like teaching them to smoke\ntobacco—in a world where only one company sells tobacco.\" - Richard\nStallman\n"}]}