Skip to content

Commit 01bda77

Browse files
committed
fix: Handle empty commit message
1 parent c00f37f commit 01bda77

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

auto_commit.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ def git_commit_everything(message):
8181
Stages all changes (including new, modified, deleted files), commits with the given message,
8282
and pushes the commit to the current branch on the default remote ('origin').
8383
"""
84+
if not message:
85+
return
8486
# Stage all changes (new, modified, deleted)
8587
subprocess.run(['git', 'add', '-A'], check=True)
8688
# Commit with the provided message
@@ -102,7 +104,7 @@ def main():
102104
commit_messages = diff_single_file(file)
103105
commit_messages_text = "\n".join(commit_messages)
104106
print(f"{commit_messages_text}")
105-
if (commit_single_file):
107+
if commit_single_file:
106108
git_commit_everything(commit_messages_text)
107109
else:
108110
all_commit_messages.extend(commit_messages)

0 commit comments

Comments
 (0)