This commit is contained in:
Alessio Izzo 2025-12-26 21:14:01 -05:00 committed by GitHub
commit 4884352391
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 40 additions and 5 deletions

View file

@ -371,7 +371,10 @@ def run(
environ.get('_PRE_COMMIT_SKIP_POST_CHECKOUT')
):
return 0
# prevent pushing staged files not committed (#2486)
if args.hook_stage == 'pre-push' and git.get_staged_files():
logger.error('Staged files found. Please commit before pushing')
return 1
# Expose prepare_commit_message_source / commit_object_name
# as environment variables for the hooks
if args.prepare_commit_message_source: