Title: [295362] trunk/Tools/Scripts/hooks/prepare-commit-msg
- Revision
- 295362
- Author
- commit-qu...@webkit.org
- Date
- 2022-06-07 13:15:44 -0700 (Tue, 07 Jun 2022)
Log Message
[git-webkit] git-webkit revert won't trigger pre-commit hook properly
https://bugs..webkit.org/show_bug.cgi?id=241202
rdar://problem/94251413
Patch by Zhifei Fang <facetothef...@gmail.com> on 2022-06-07
Reviewed by Jonathan Bedard.
* Tools/Scripts/hooks/prepare-commit-msg:
Canonical link: https://commits.webkit.org/251370@main
Modified Paths
Diff
Modified: trunk/Tools/Scripts/hooks/prepare-commit-msg (295361 => 295362)
--- trunk/Tools/Scripts/hooks/prepare-commit-msg 2022-06-07 20:14:22 UTC (rev 295361)
+++ trunk/Tools/Scripts/hooks/prepare-commit-msg 2022-06-07 20:15:44 UTC (rev 295362)
@@ -74,8 +74,14 @@
return ''
def main(file_name=None, source=None, sha=None):
- if source not in (None, 'commit', 'template'):
+ with open(file_name, 'r') as commit_message_file:
+ content = commit_message_file.read()
+
+ if source not in (None, 'commit', 'template', 'merge'):
return 0
+
+ if source == 'merge' and not content.startswith('Revert'):
+ return 0
if os.environ.get('GIT_EDITOR', '') == ':':
# When there's no editor being launched, do nothing.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes