-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Analyzer: Git downloader does not use latest commit when revision is not fixed #7725
Comments
@mnonnenmacher I tested with and without 53e755d and this is the guilty bit. |
I'm having a look at this... meanwhile, would you be able to contribute a (for now failing) test case @nnobelis? |
@sschuberth I will try but I imagine this is not an obvious issue to pinpoint: As far as I know, only one of our customers reported this behavior. |
Unfortunately, I didn't manage to get a working test, but I think I know where the error might lies. In the test written by @mnonnenmacher , https://github.com/bosch-io/oss-review-toolkit/blob/400e9efc4b6dd8bfba6c4cad37ec85b11f693b50/plugins/version-control-systems/git/src/funTest/kotlin/GitFunTest.kt#L84-L92, the run is an "happy path" : The test managed to do the In this case, the file
Which means only one branch is considered. In the case of our customer, all the fetches with JGit fail with this error:
Maybe due to https://bugs.eclipse.org/bugs/show_bug.cgi?id=581228. Anyway, in the end Git CLI is used instead of JGit for the fetch:
In this case, the file FYI: This interesting comment https://stackoverflow.com/a/50568481 mentions that |
I wrote this morning a test with MockK to force the usage of Git CLI. Unfortunately, it seems this usage is not the culprit here, as suggested by my previous comment. I noticed that all Additionally, I compared the file
So I think in the case of ORT, this file is not generated correctly by JGit because we are missing the entry, hence the bug. |
The `.git/FETCH_HEAD` file does not only contain a single ref for the current branch, but all refs that have been fetched last. Do not assume the entry for the current branch to be the first one, and use JGit's `FetchResult` to search for the correct resolved revision to reset to. Fixes #7725. Signed-off-by: Sebastian Schuberth <[email protected]>
The `.git/FETCH_HEAD` file does not only contain a single ref for the current branch, but all refs that have been fetched last. Do not assume the entry for the current branch to be the first one, and use JGit's `FetchResult` to search for the correct resolved revision to reset to. Fixes #7725. Signed-off-by: Sebastian Schuberth <[email protected]>
The `.git/FETCH_HEAD` file does not only contain a single ref for the current branch, but all refs that have been fetched last. Do not assume the entry for the current branch to be the first one, and use JGit's `FetchResult` to search for the correct resolved revision to reset to. Fixes #7725. Signed-off-by: Sebastian Schuberth <[email protected]>
@sschuberth Yes the fix did the trick. Thanks ! |
One of our customers wants to run the Analyzer on the
master
branch of his repository.When the run has finished :
This revision is not the latest commit from
master
, this is some old commit from 6 months ago !I have seen that #7556 introduced a
FETCH_HEAD
mechanism for non fixed revisions.I have also found that JGit may not be setting
FETCH_HEAD
properly: https://stackoverflow.com/questions/24682310/fetching-with-jgit-doesnt-show-the-last-commitCould we have an issue here ?
I don't know what I could give for extra information but I would like @mnonnenmacher opinion on this.
The text was updated successfully, but these errors were encountered: