Skip to content

Commit a4709b9

Browse files
handle case with detached head in git message
1 parent d5702ed commit a4709b9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

wellies/deployment.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ def git_commit_message(message_args):
6060

6161
commit_hash = repo.head.commit.hexsha
6262
remote_url = next(repo.remote().urls)
63-
branch_name = repo.active_branch.name
63+
if repo.head.is_detached:
64+
branch_name = "Detached HEAD"
65+
else:
66+
branch_name = repo.active_branch.name
6467
default_message += "\nGit info:\n"
6568
default_message += f" - Remote URL: {remote_url} \n"
6669
default_message += f" - Commit: {commit_hash}\n"

0 commit comments

Comments
 (0)