Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Empty Refs Map
icon2.gif  Empty Refs Map [message #647361] Wed, 05 January 2011 18:55 Go to next message
Brian  is currently offline Brian Friend
Messages: 6
Registered: January 2011
Junior Member
Ok, I finally broke down and downloaded the jgit project due to the fact that there's not really much documentation available, so I'm looking through the source code to try to figure this out. Not having much luck though.

Basically what's happening is my refs map in my repository is coming back empty (not null, just empty).

Here's my repository initialization code, maybe you can tell me what I'm missing:

      Config config = (Config) ConfigManager.getInstance().getConfig(Config.class);
      FileRepositoryBuilder builder = new FileRepositoryBuilder();
      builder = builder.setGitDir(new File(config.getGitRepoDirectory())); //repo directory points to my project root
      Repository repo = builder.findGitDir().build();
      System.out.println(repo.getAllRefs()); //Prints "[]"
      git = new Git(repo);

I'm aware that this differs from the user guide's example of setting up a a repository; however the example in the user guide appears to be broken.

*edit 2*
I did a System.out.println(repo.getRepositoryState()); and it appears JGit thinks it's working with a bare repository, in spite of the presence of a .git directory and all that goes with it

[Updated on: Wed, 05 January 2011 21:11]

Report message to a moderator

Re: Empty Refs Map [message #647383 is a reply to message #647361] Wed, 05 January 2011 21:19 Go to previous message
Brian  is currently offline Brian Friend
Messages: 6
Registered: January 2011
Junior Member
Never mind. Just figured it out - apparently the repository builder is expecting me to point to the .git directory, not just the project root. Hopefully this doesn't mean it won't work with my checked-out copy of the repository....

Of course, now I've got a new exception, but I'll work on that one for a while before posting again
Previous Topic:Difference for commit between files, index and tracked.
Next Topic:New to JGit - need to embed git control in application
Goto Forum:

Current Time: Sun Oct 02 23:44:02 GMT 2022

Powered by FUDForum. Page generated in 0.02310 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top