git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [jgit] index v2 pull request

From
Shawn O. Pearce <spearce@spearce.org>
Date
Mar 11, 2008, 00:35 UTC
Message-ID
<20080311003526.GM8410@spearce.org>
In-Reply-To
<7bfdc29a0803100032q6b30f16el97c021f3b051b944@mail.gmail.com>
Imran M Yousuf <imyousuf@gmail.com> wrote:
> I would like to volunteer to work in JGit;
> can someone let me know where I can pick some tasks to implement?

One of the areas that I think is really weak in JGit and that we need to do a _good_ fetch/push implementation is the branch model.

For example, if you look at Repository.getBranches() it returns to the caller a Collection<String>.

But in Git a branch is a heck of a lot more data, and that data is relevant to the end user when we are talking about fetch and merge. There are many configuration options stored in .git/config for a branch, and these are (today) created by git-branch and git-checkout automatically as the user creates and deletes branches.

JGit has none of this model. It thinks all that a branch is is a String. Sad.

Another thing that bothers me is the packed refs cache. We toss away the peeled information (the "^" lines), but that data is very useful when you are talking about fetch as well as a few other types of operations, like plotting tag labels onto a history graph (such as how gitk does it).

The Ref class was started as a means of wrapping up the various important bits of data about a ref (of which branches are a subclass and annotated tags with peeled data is another) but I suspect it didn't quite do everything so these string APIs got created.

The above is a farily small task, one that any good OO programmer should be able to tackle, but it can be challenging if you are new to Git plumbing as you'll have to learn what are the important parts of a branch/ref/annotated tag.

As a starting point look at the config file format in C Git and see what is possible in a "branch" and "remote" section; that data needs to be pretty readily available for any Ref, if such data exists. The backward mapping of Ref->Remote (which does not exist yet, unless Robin created it) is quite relevant for tracking branches.

-- 
Shawn.
Previous: Imran M YousufNext: Imran M Yousuf
Message 11 of 13 in “[jgit] index v2 pull request”
  1. Shawn O. PearceMar 8, 2008
  2. Jakub NarebskiMar 8, 2008
  3. Shawn O. PearceMar 9, 2008
  4. Robin RosenbergMar 9, 2008
  5. Imran M YousufMar 10, 2008
  6. Robin RosenbergMar 10, 2008
  7. Imran M YousufMar 12, 2008
  8. Robin RosenbergMar 12, 2008
  9. Shawn O. PearceMar 12, 2008
  10. Imran M YousufMar 12, 2008
  11. Shawn O. PearceMar 11, 2008
  12. Imran M YousufMar 11, 2008
  13. Shawn O. PearceMar 10, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.