From 2bd8a595d15f12ec765315a99109cfd9680f912e Mon Sep 17 00:00:00 2001 From: "M. Krostelev" Date: Tue, 10 Sep 2024 14:35:47 +0300 Subject: [PATCH] issue-3292 expose commit_msg_filename as environment variable for the hooks --- pre_commit/commands/run.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pre_commit/commands/run.py b/pre_commit/commands/run.py index 793adbdb..4c77aa0f 100644 --- a/pre_commit/commands/run.py +++ b/pre_commit/commands/run.py @@ -371,7 +371,7 @@ def run( ): return 0 - # Expose prepare_commit_message_source / commit_object_name + # Expose prepare_commit_message_source / commit_object_name / commit_msg_filename # as environment variables for the hooks if args.prepare_commit_message_source: environ['PRE_COMMIT_COMMIT_MSG_SOURCE'] = ( @@ -381,6 +381,9 @@ def run( if args.commit_object_name: environ['PRE_COMMIT_COMMIT_OBJECT_NAME'] = args.commit_object_name + if args.commit_msg_filename: + environ['PRE_COMMIT_COMMIT_MSG_FILENAME'] = args.commit_msg_filename + # Expose from-ref / to-ref as environment variables for hooks to consume if args.from_ref and args.to_ref: # legacy names