Skip to content

fix: include_remote: false had no effect on revwalk scope#9

Merged
peso merged 4 commits into
git-bahn:masterfrom
stumash:fix/local-flag-revwalk-scope
Jun 30, 2026
Merged

fix: include_remote: false had no effect on revwalk scope#9
peso merged 4 commits into
git-bahn:masterfrom
stumash:fix/local-flag-revwalk-scope

Conversation

@stumash

@stumash stumash commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

When no refspecs were provided, configure_revwalk always called push_glob("*"), walking all refs regardless of Settings::include_remote. This meant Builder::with_max_count would count commits from the full graph even when the caller requested local-only traversal.

Fix: pass include_remote into configure_revwalk and use push_glob("refs/heads/*") when false.

When --local is used, configure_revwalk was still calling
push_glob("*") which walks all refs including remotes. This meant
-n counted commits from the full graph rather than the local-only
subgraph.

Fix by passing include_remote from Settings into configure_revwalk
and using push_glob("refs/heads/*") when remote refs should be
excluded.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@stumash

stumash commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

@peso this fix is so that when using git-graph, the --local and -n flags work well together. right now, if I do

git-graph --local -n 10

it won't show me 10 commits from the --local subgraph. instead it will show me probably less than 10 commits because first it gets 10 commits and then it filters for what's local.

@stumash

stumash commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

my workaround for now using is to pass git-graph all the local branch names manually, which does work, but defeats the purpose of the --local flag

@peso

peso commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Looks good, but you need to run cargo fmt before it can pass CI.

@stumash

stumash commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

I didn't want to do formatting on files that were already failing in the master branch and introduce unrelated changes
edit: I didn't realize cargo fmt only applies to my changes

I'll do it now though one sec

@stumash

stumash commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

alright @peso I ran cargo fmt on the files I modified. Any linting issues in CI that remain are the same as those on the master branch

@stumash

stumash commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

@peso I applied linter fixes to all the other files in the repo to pass CI. ready to merge whenever

@peso

peso commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Sorry that you had to fix formatting outside your PR. I forgot the state the code is still in.
But thank you for that upgrade as well.

@peso
peso merged commit 636d745 into git-bahn:master Jun 30, 2026
2 checks passed
@stumash

stumash commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

huge fan, love git-graph. truly it's the only thing on the internet that will dump a human readable recent git history into my terminal. happy to contribute a fix.

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