Skip to content
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

JGIT blame doesn't emit revision/author for some lines causing a mismatch for all following lines #4707

Open
aerofeev2k opened this issue Jan 8, 2025 · 3 comments

Comments

@aerofeev2k
Copy link

I'm seeing an issue with a mismatch between second/third columns (containing revision number and author) in OpenGrok Annotate page and actual file contents for GIT files.

It appears that for some commits revision/author entries are not emitted, meaning that:

  1. Though the file's line is output, the corresponding revision/author is not;
  2. As a result, for the rest of the file revision/author are shifted up by one line;
  3. At the end of the Annotate page the last line of the file has empty revision/author.

"git blame" has no problem showing correct info.

It seems that the two things that are different about the commits that cause the mismatch is a space in the developer's name and a different timezone (as reported by "git blame"). Some commits are just trivial single line insertions.

Has anything like that been seen and perhaps fixed in the last year? Is it possible to switch OpenGrok to using "git blame" command rather than JGIT for generating Annotate pages through some config setting?

I tried replacing org.eclipse.jgit-5.12.0.202106070339-r.jar with a newer 7.0 version, but that didn't really make any difference.

Thanks!

@vladak
Copy link
Member

vladak commented Jan 8, 2025

If you could come up with a simple reproducible scenario/repository, that would be great.

The JGit use by the GitRepository is hard-coded and cannot be changed. I am now aware of any major changes to GitRepository in the last couple of years that would affect the annotate view, maybe besides the annotation cache (which is disabled by default and should not affect the way how annotate is displayed functionally).

@aerofeev2k
Copy link
Author

Well, another commit was done today, and things got magically fixed. I now think that it may be related to merge commits because they're not shown in OpenGrok history, and yesterday it was a merge commit on the tip, according to "git log", and something else, according to OpenGrok.

@aerofeev2k
Copy link
Author

Yeah, just noticed this with another file that has a merge commit on the tip. So, is this happening because when OpenGrok is doing "git blame", it's doing it against the last non-merge commit that it sees in the history, but when displaying the annotation results it's using source code that currently sits in the current directory (and includes the merge commit changes)? Hence the discrepancy between annotations and source code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants