git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bug sorting git branch output by ahead-behind:HEAD
@ 2025-01-05  9:48 Ross Goldberg
  2025-01-12 10:01 ` [PATCH] ref-filter: share bases and is_base_tips between formatting and sorting René Scharfe
  0 siblings, 1 reply; 19+ messages in thread
From: Ross Goldberg @ 2025-01-05  9:48 UTC (permalink / raw)
  To: git

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]

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2025-01-19 12:46 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-05  9:48 Bug sorting git branch output by ahead-behind:HEAD Ross Goldberg
2025-01-12 10:01 ` [PATCH] ref-filter: share bases and is_base_tips between formatting and sorting René Scharfe
2025-01-13  5:17   ` Jeff King
2025-01-13  5:23     ` Jeff King
2025-01-13 17:25     ` Junio C Hamano
2025-01-14 18:55     ` René Scharfe
2025-01-16  9:51       ` Jeff King
2025-01-16 10:06         ` Jeff King
2025-01-16 10:21           ` Jeff King
2025-01-16 17:31             ` Junio C Hamano
2025-01-18 17:11             ` René Scharfe
2025-01-19  9:11               ` René Scharfe
2025-01-19  9:11               ` René Scharfe
2025-01-19  9:26               ` René Scharfe
2025-01-19 12:40                 ` Jeff King
2025-01-18 17:11         ` René Scharfe
2025-01-18 17:11   ` [PATCH v2 1/3] ref-filter: move ahead-behind bases into used_atom René Scharfe
2025-01-18 17:11   ` [PATCH v2 2/3] ref-filter: move is-base tip to used_atom René Scharfe
2025-01-18 17:11   ` [PATCH v2 3/3] ref-filter: remove ref_format_clear() René Scharfe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).