Skip to content

bugfix: Fix git shortlog returning no output in non-TTY environments - #275

Merged
saraedum merged 2 commits into
regro:masterfrom
travishathaway:shortlog-in-non-tty-fix
May 19, 2026
Merged

saraedum merged 2 commits into
regro:masterfrom
travishathaway:shortlog-in-non-tty-fix

Conversation

@travishathaway

@travishathaway travishathaway commented May 15, 2026 •

Copy link
Copy Markdown
Contributor

Introduction

Hi maintainers 👋,

This is my first contribution to this repository, so if I have not done anything correctly, please excuse me and just let me know what to do.

I found this bug while releasing conda 26.5.0. I specifically found it because I was using rever in an opencode session where it was in a non-TTY environment.

The bug fix submitted was something that my LLM (Claude Opus 4.6) suggested to me, and I have gone even further by including regression tests that we're also written by the LLM.

Please let me know if these change are acceptable and what I can do to improve them if they are not.

Thanks!

Full description of changes

git shortlog without an explicit revision reads from stdin. In non-interactive environments (CI, subprocess calls, agent runners) stdin is empty/closed, so it exits immediately with no output. This caused git_commits_per_author and git_commits_per_email to return empty dicts, silently setting every author's num_commits to 0.

Fix by appending HEAD to the args when no since boundary is given, so git shortlog always traverses the full commit history regardless of whether stdin is a terminal. The same bug exists in both git_commits_per_author and git_commits_per_email since they share the same pattern.

@travishathaway
travishathaway marked this pull request as ready for review May 15, 2026 09:39
@saraedum
saraedum merged commit 2adf12e into regro:master May 19, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants