-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix git commit parser sometimes returning wrong diffs
Problem 1: sometimes the path for a diff is wrong. This is because `commit_utils.parse_patch()` assumes that the diffs are in the same order as the filenames in the commit header, which turns out to not always be true. Solution: get the path name from the `+++ b/path` or `--- a/path` lines of the diff header. Problem 2: turning merge commits into individual commits by calling `git show` with the `-m` option does not work when fetching only some files inside the commit (which we do when scanning huge commits): it always return the changes from the first parent. Solution: maybe it would be possible to return the changes from the correct parents, but it felt simpler to stop using the `-m` option. As a bonus, it simplifies `parse_patch()` because it can now assume that there is only one commit per patch.
- Loading branch information
1 parent
807c2ba
commit f7ae8e1
Showing
4 changed files
with
160 additions
and
47 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
changelog.d/20240910_170441_aurelien.gateau_fix_git_parser.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### Fixed | ||
|
||
- The git commit parser have been reworked, fixing cases where commands scanning commits would fail. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters