Bug sorting git branch output by ahead-behind:HEAD
- From
- Ross Goldberg <ross.goldberg@gmail.com>
- Date
- Jan 5, 2025, 09:48 UTC
- Message-ID
- <CAAEcvMovcZucuq4H70ouQzKS=_wHnBi1DqJ-4MMFVXX9XLEciw@mail.gmail.com>
Bug sorting git branch output by ahead-behind:HEAD
What did you do before the bug happened? (Steps to reproduce your issue)
$ git branch --format '%(refname:short) %(ahead-behind:HEAD)' (HEAD detached at 6aab6bfe) 0 0 190-json 1 6 560-swupd 3 6 667-reset-no-process 2 6 678-completions 2 0 693-readme-accordions 3 6 705-branch-in-version 2 6 main 0 6
$ git branch --format '%(refname:short) %(ahead-behind:HEAD)' --sort 'ahead-behind:HEAD' (HEAD detached at 6aab6bfe) 190-json 560-swupd 667-reset-no-process 678-completions 693-readme-accordions 705-branch-in-version main
What did you expect to happen? (Expected behavior)
I expected the second command's output to:
- include the value of `ahead-behind:HEAD` on each line - have been sorted by each line's value of `ahead-behind:HEAD`
What happened instead? (Actual behavior)
Second command's output missing `ahead-behind:HEAD` & sorted by `refname`
What's different between what you expected and what actually happened?
Fields missing from second command's output
Incorrect sorting of second command's output lines
Anything else you want to add:
If I sort by the `objectsize` field:
- all requested fields are output - sorting works (except `(HEAD detached at 6aab6bfe)` is always listed first)
If I do not include `%(ahead-behind:HEAD)` in the format string, sorting by `ahead-behind:HEAD` still doesn't work.
Please review the rest of the bug report below. You can delete any lines you don't wish to share.
[System Info] git version: git version 2.47.1 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh feature: fsmonitor--daemon libcurl: 7.79.1 zlib: 1.2.11 uname: Darwin 21.6.0 Darwin Kernel Version 21.6.0: Mon Jun 24 00:56:10 PDT 2024; root:xnu-8020.240.18.709.2~1/RELEASE_X86_64 x86_64 compiler info: clang: 14.0.0 (clang-1400.0.29.202) libc info: no libc information available $SHELL (typically, interactive shell): /usr/local/bin/zsh
[Enabled Hooks]