git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] completion: new config var to use --sort in for-each-ref

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 27, 2025, 22:21 UTC
Message-ID
<87bjp56zs0.fsf@gitster.g>
In-Reply-To
<pull.1946.git.1753627773304.gitgitgadget@gmail.com>

"Nelson Benitez Leon via GitGitGadget" <gitgitgadget@gmail.com> writes:

Show 14 quoted lines
> From: =?UTF-8?q?Nelson=20Ben=C3=ADtez=20Le=C3=B3n?= <nbenitezl@gmail.com>
>
> Currently when completing refs, e.g. by doing "git checkout <TAB>", all
> refs are shown in alphabetical order, this is an implicit ordering and
> cannot be changed.
>
> This commit will make the sort criteria to now be explicit, mandated by
> a new config var which will be used for the --sort=<val> of for-each-ref
>
> This new config var will have a default value of alphabetical order,
> so Git's default behaviour remains unchanged.
>
> Also add '-o nosort' to 'complete' to disable its default alphabetical
> ordering so our new explicit ordering prevails.
The usual way to compose a log message of this project is to
 - Give an observation on how the current system works in the
   present tense (so no need to say "Currently X is Y", or
   "Previously X was Y" to describe the state before your change;
   just "X is Y" is enough), and discuss what you perceive as a
   problem in it.
 - Propose a solution (optional---often, problem description
   trivially leads to an obvious solution in reader's minds).
 - Give commands to somebody editing the codebase to "make it so".
   There is no place to say "this commit will"; instead, give order
   to the code.
in this order.
> Signed-off-by: Nelson Benítez León <nbenitezl@gmail.com>
> ---
>     I've not added tests because I'm not familiar with the test machinery,
>     hopefully this is still useful.

Tests are required part of a new feature to become part of Git codebase. Otherwise you cannot notice if somebody else later changes the code further and accidentally breaks your feature.

You can of course ask for help (i.e. "I'm not familiar with the test machinery so I am not writing any" is *not* acceptable. "I'm not familiar with the test machinery; among those who may find this new feature worthwhile to do, could somebody lend me a hand?" is very good).

>     ... and I don't want to activate 2FA
>     authentication just for this ...
You could do OAuth these days, I hear?
Previous: Nelson Benítez LeónNext: SZEDER Gábor
Message 3 of 4 in “completion: new config var to use --sort in for-each-ref”
  1. completion: new config var to use --sort in for-each-refNelson Benitez Leon via GitGitGadget, Jul 27, 2025
  2. Nelson Benítez LeónJul 27, 2025
  3. Junio C HamanoJul 27, 2025
  4. SZEDER GáborJul 28, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.