Skip to content

Commit

Permalink
remove print from detached HEAD, fix #29
Browse files Browse the repository at this point in the history
  • Loading branch information
brainelectronics committed Oct 12, 2024
1 parent 3369d04 commit ed163e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .snippets/29.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Remove print in branch property of HistoryWalker
<!--
type: bugfix
scope: all
affected: all
-->

Using the `branch` property of `HistoryWalker` in `collector.py` would print `HEAD is detached: ...` in case the HEAD is detached during a pull request build. This could lead to errors while creating a changelog with `--dry-run` and passing the output to a supposed JSON file, being finally unable to parse it as with that detached HEAD output it's not a JSON anymore.
2 changes: 1 addition & 1 deletion snippets2changelog/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def branch_name(self) -> str:
try:
return str(self._repo.active_branch)
except Exception as e:
# print(f"HEAD is detached: {e}")
# HEAD is detached
return str(self._repo.head.commit.hexsha)

@property
Expand Down

0 comments on commit ed163e0

Please sign in to comment.