Skip to content

Improved unified diff compatibility for --diff option #67

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

Closed

Conversation

rg3igalia
Copy link

Universal diffs as generated by git (for example) have some compatibility problems regarding what lcov --diff expects. This pull request fixes a few of those problems to make it easier to use git diffs. In particular:

  • Start-of-block lines are now allowed to have comments after the ending @@. Git sometimes uses this to give hints about the diff block location, like the function name.
  • The diff reader has been changed to track more state and to be a bit more flexible, due to git printing more info lines in between files and in the header, like when using git show.
  • In addition, I've added an .editorconfig file that can be used to maintain some style when using different editors like Vim, Emacs, VS Code, etc.
  • Thanks to the previous point, I've also fixed some minor whitespace issues.

@henry2cox
Copy link
Collaborator

I was going though old PRs and found this one. 4 years is a long time - sorry.

In the meantime, the lcov code has been refactored quite a bit.
Merging this PR is pretty straightforward, as the only changes we want are in the 'read_diff' function.
There - apart from reformatting via make checkstyle MODE=full UPDATE=1 (to match lcov coding standard) - the only change that is needed is to call 'lcovutil::strip_directories' rather than 'strip_directories')

The other thing that is needed is a 'Signed-off-by:' line in your commit/PR.
I can do both of those things - if I knew your email address for the signoff line.

@rg3igalia
Copy link
Author

Oh, thanks for reviewing! Better late than ever. If you could take care of both things, it would be great. My email address is rgarcia AT igalia DOT com.

henry2cox added a commit that referenced this pull request May 17, 2023
Original commit message:

Universal diffs as generated by git (for example) have some compatibility problems regarding what lcov --diff expects. This pull request fixes a few of those problems to make it easier to use git diffs. In particular:

 - Start-of-block lines are now allowed to have comments after the
   ending @@. Git sometimes uses this to give hints about the diff
   block location, like the function name.
 - The diff reader has been changed to track more state and to be
   a bit more flexible, due to git printing more info lines in between
   files and in the header, like when using git show.

Committed by:  Henry Cox (henry.cox@mediatek.com) on behalf of Ricardo Garcia (rgarcia@igalia.com)

Signed-off-by:  Ricardo Garcia <rgarcia@lgalia.com>
@henry2cox
Copy link
Collaborator

above commit pushed the refactored PR.

Thank you for your contribution.
Henry

@henry2cox henry2cox closed this May 17, 2023
@rg3igalia
Copy link
Author

You're welcome and thanks for merging!

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

Successfully merging this pull request may close these issues.

2 participants