summaryrefslogtreecommitdiff
path: root/utils/ipc/generators/__init__.py
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-08-10 02:43:59 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-08-12 15:44:17 +0300
commiteeb435bbda98da9f03d56e23722e4ac741d6107c (patch)
tree738e29be9c2a671e97b7a2f5f310025c388c0ba1 /utils/ipc/generators/__init__.py
parentf87bf964fc108675c48b168e9b1d2629a3461bef (diff)
utils: checkstyle.py: Rework commit message parsing
When parsing commit messages, the Commit class tries to optimize the process by invoking git-show once only, extracting both the commit author, title and modified files in one go. As a result, the derived Amendment class needs to implement the commit parsing separately, as the modified files need to be extracted differently for amendments (and the commit ID also needs to be retrieved differently). Furthermore, because of the list of named files, extracting the trailers needs to invoke git-show separately. Improve the situation by reworking the commit message parsing in three steps. In the first step, use git-show to extract the commit ID, author, title and body. In the second step, invoke git-interpret-trailers to extract the trailers from the body that was previously extracted. The third and final step extracts the list of modified files, using different methods for regular commits and amendments. This allows sharing code for the first two steps between the Commit and Amendment classes, making the code simpler. The Commit class still invokes git three times, while the Amendment class runs it three times instead of four, improving performance slightly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Diffstat (limited to 'utils/ipc/generators/__init__.py')
0 files changed, 0 insertions, 0 deletions