Bug 439675 - LogCommand returns incorrect result in some cases
Summary: LogCommand returns incorrect result in some cases
Status: NEW
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: 3.4.1   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: 3.5   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-16 03:18 EDT by Robin Shen CLA
Modified: 2014-12-18 22:33 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Shen CLA 2014-07-16 03:18:33 EDT
This can be reproduced from the mozilla gecko repository as described below:

1. git clone https://github.com/mozilla/gecko-dev.git gecko

2. change to gecko directory and run below command:
git log dd19f59774ba8cf47f4a447f408a71b7950ba564..dd19f59774ba8cf47f4a447f408a71b7950ba564~5
git log gives no result which is correct.

3. now do the same thing with jgit:

Repository repo = RepositoryCache.open(FileKey.lenient(new File("/path/to/gecko"), FS.DETECTED));
Git git = new Git(repo);

ObjectId fromId = repo.resolve("dd19f59774ba8cf47f4a447f408a71b7950ba564");
ObjectId toId = repo.resolve("dd19f59774ba8cf47f4a447f408a71b7950ba564~5");

System.out.println(git.log().addRange(fromId, toId).call().iterator().hasNext());

repo.close();

This program prints "true" at the console indicating that it finds some log entries, which is incorrect.
Comment 1 Robin Rosenberg CLA 2014-07-17 07:15:50 EDT
ouch. looks really bad.

The code returns the same as this jgit call:
jgit log dd19f59774ba8cf47f4a447f408a71b7950ba564..dd19f59774ba8cf47f4a447f408a71b7950ba564~5 

It is supposed to do the same as it's correpsonding git command, ie. ".." but it doesn't instead it return three commits from dd19f59774ba8cf47f4a447f408a71b7950ba564~5, i.e.

f940812cbe7aa460930a7a7ed3a56f8feb4114d9 : Bug 1018255 - Fix a short-circuit evaluation bug in OverscrollSnapBackAnimation::Sample. r=kats
7733d1d4eb1311da9f35d070db707708f6df64d9 : Bug 1018255 - Don't bother doing the computations in ApplyOverscrollEffect if we are not overscrolled. r=kats
b6bd6e60b1c2aaed82841cea614528cf934b35c0 : Bug 1018255 - Stop fling more quickly when overscrolled. r=kats

I was kind of expecting that it might do what log with ... would do, but not even that.
Comment 2 Andrew Oberstar CLA 2014-12-18 22:33:43 EST
I'm not positive this is the same issue, but I've noticed some odd ordering differences in JGit as of 3.4.1. I did a bisect and traced it down to this commit. Unfortunately, I'm not familiar enough with JGit internals to understand how this would cause the issue. Does this seem relevant?

https://github.com/eclipse/jgit/commit/f716ad6d54ac74f9445b869f3fdd2b46256d1259