Skip to content

Added sort by commiter date - #153

Open
agido-malter wants to merge 9 commits into
msiemens:masterfrom
agido-malter:master
Open

agido-malter wants to merge 9 commits into
msiemens:masterfrom
agido-malter:master

Conversation

@agido-malter

Copy link
Copy Markdown
Contributor

My first idea for #138

feat: add opt-in branch sorting
Add --branch-sort and git-up.branch.sort support using Git for-each-ref sorting semantics.

Preserve the historical alphabetical order by default and deliberately
ignore Git's native branch.sort setting to avoid implicit behavior
changes on upgrade.

agido-malter and others added 8 commits July 22, 2026 18:06
Make fetch progress opt-in, respect quiet mode, and handle
non-ASCII refs and fetch failures without duplicate output.
Add --branch-sort and git-up.branch.sort support using Git for-each-ref sorting semantics.

Preserve the historical alphabetical order by default and deliberately
ignore Git's native branch.sort setting to avoid implicit behavior
changes on upgrade.

Add tests and documentation for sorting precedence and compatibility. Ref to msiemens#138
@msiemens

msiemens commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Hey @agido-malter, thanks for the PR, it looks really good! From what I can see, there are only two issues:

  1. If a local branch has the same name as a tag (e.g. a branch v1 and a tag v1), %(refname:short) returns heads/v1 instead of v1, so positions[branch.name] crashes with a KeyError. Maybe you could use --format=%(refname:lstrip=2) instead? Could you add a test for that too?
  2. An invalid sort key (e.g. --branch-sort=bogus or a typo in git-up.branch.sort) makes git for-each-ref fail inside the constructor. run() then just calls sys.exit(1) without printing anything, so git up silently does nothing. Could we print the error here, like the other constructor errors do?

Also, test_git_up_branch_sort_overrides_native_config sets git-up.branch.sort to refname, which is the same as the default order. So the test would still pass if the config value was ignored entirely, right? Maybe use -committerdate there so we actually test that the config option works?

@agido-malter

Copy link
Copy Markdown
Contributor Author

@msiemens thanks for your findings. I fixed them

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