Skip to content

fix: honor explicit -n N limit for git log on merge commits#2015

Open
okwn wants to merge 2 commits into
rtk-ai:developfrom
okwn:contrib/rtk/git-log-merge-fix
Open

fix: honor explicit -n N limit for git log on merge commits#2015
okwn wants to merge 2 commits into
rtk-ai:developfrom
okwn:contrib/rtk/git-log-merge-fix

Conversation

@okwn
Copy link
Copy Markdown

@okwn okwn commented May 21, 2026

No description provided.

When user runs 'git log -1 --format='%H' HEAD' where HEAD is a merge
commit, rtk was adding --no-merges which filtered out the merge commit
itself and returned the second parent instead. This made 'git log -1'
return wrong SHAs for merge commits.

Fix: don't add --no-merges when user explicitly passes -n N or
--max-count=N. When a user specifies an exact count they expect exactly
that many commits, not filtered results. Also skip --no-merges if user
already passed --merges or --no-merges explicitly.

Fixes rtk-ai#2009.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 21, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ aeppling
❌ okwn
You have signed the CLA already but the status is still pending? Let us recheck it.

@aeppling
Copy link
Copy Markdown
Contributor

Hey, pretty straightforward

Thanks for contributing to RTK !

@aeppling aeppling self-assigned this May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants