Skip to content

Commit 42b7a6e

Browse files
authored
fix: commit annotator fails on merge commits (#1846)
1 parent be02490 commit 42b7a6e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

release-controller/git_repo.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,12 @@ def checkout(self, ref: str) -> None:
337337
)
338338

339339
def parent(self, object: str) -> str:
340-
return check_output(
340+
"""Return the first parent of a commit (or empty string for root commits)."""
341+
parents = check_output(
341342
["git", "log", "--pretty=%P", "-n", "1", object],
342343
cwd=self.dir,
343-
).strip()
344+
).strip().split()
345+
return parents[0] if parents else ""
344346

345347
def branch_list(self, pattern: str) -> typing.List[str]:
346348
return [

0 commit comments

Comments
 (0)