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

From: Junio C Hamano <[email-masked]>
Date: Sun, 27 Jul 2025 15:21:19 -0700

"Nelson Benitez Leon via GitGitGadget" <[email-masked]>
writes:

> From: =?UTF-8?q?Nelson=20Ben=C3=ADtez=20Le=C3=B3n?= <[email-masked]>
>
> 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 <[email-masked]>
> ---

>     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?