79542081

Date: 2025-03-28 17:43:16
Score: 2
Natty:
Report link

As Rudiger suggested, the answer is straightforward.

Instead of using repo.getBranch() to get the branch name, use repo.getFullBranch() to get it.

The full-branch version returns a string "refs/heads/[branchname]" if we're on a branch, or a raw SHA-1 if we are not.

Confirmed, tested, and pushed.

Thanks!

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Low length (0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: GeePawHill