Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 368370 - Repository#resolve() methods returns invalid objectIds when using params like refs/heads/0.1-0^{tree}:admin/appdemo/Main.tpl
Summary: Repository#resolve() methods returns invalid objectIds when using params like...
Status: RESOLVED FIXED
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: 1.2   Edit
Hardware: All Windows XP
: P3 major (vote)
Target Milestone: 1.3-M1   Edit
Assignee: Kevin Sawicki CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-11 12:10 EST by Daniel Pacak CLA
Modified: 2012-01-15 19:20 EST (History)
0 users

See Also:


Attachments
Test Git repo and java unit test showing a bug. (19.47 KB, application/zip)
2012-01-11 12:10 EST, Daniel Pacak CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Pacak CLA 2012-01-11 12:10:05 EST
Created attachment 209322 [details]
Test Git repo and java unit test showing a bug.

I found the case when the org.eclipse.jgit.lib.Repository#resolve() methods returns invalid objectId(s).

Attached you can find a small Git repository and a maven project with the unit test which demonstrates invalid behavior.
Note that in the test repo I have a branch named '0.1-0' and I want to retrieve the content of a file from this branch under the admin/appdemo/Main.tpl path.
It means that somewhere in my code I'm calling:

org.eclipse.jgit.lib.Repository#resolve("refs/heads/0.1-0^{tree}:admin/appdemo/Main.tpl");

which returns pointer to a tree object instead of a blob with Main.tpl content!!

When using other Git clients (Eclipse Git plugin or command line git-scm) I can retrieve the content of all files without any problems.

What is more, when I'm using a bit different API the problem disappears (there are two methods in my Java class which are supposed to do exactly the same thing but are using slightly different API: RepositoryManager#getResourceAsString() and RepositoryManager#getResourceAsString2()).

Could you take a look at that issue please?
Thanks in advance,
Daniel Pacak
Comment 1 Kevin Sawicki CLA 2012-01-13 16:28:20 EST
Proposed fix pushed to: http://egit.eclipse.org/r/#change,4956
Comment 2 Kevin Sawicki CLA 2012-01-15 19:19:44 EST
Merged into master as commit 03b5416a35ad78773fb0a97a98686fec18c0c05e