Skip to content

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

Open
okwn wants to merge 1 commit 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 1 commit 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

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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