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
KHKristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
Date
Jun 27, 2025, 19:47 UTC
Message-ID
<a3cd775d-99fa-49de-881b-1e8f178f9102@app.fastmail.com>
In-Reply-To
<CAAUd64333fEMHAaNW=-CkfUMN4HDFF2v==HdO0OFnOgm+W+Jog@mail.gmail.com>
> Previously when completing refs eg. "git checkout <TAB>"
> all refs were alphabetically ordered, this was an
> implicit ordering and could not be changed.

Style-wise, the commit message is supposed to discuss the current behavior (without the patch) in the present tense and what this patch does in the imperative mood. Like you are commanding the code to change.[1] Something like:

    When completing refs, e.g. "git checkout <TAB>", all refs are
    alphabetically ordered; this is an implicit ordering and cannot be
    changed.
This also gels with the general pattern of:
1. Introduce the current behavior
2. The problem it causes (maybe merged with (1))
3. What to do to fix it
> Previously when completing refs eg. "git checkout <TAB>"
s/eg./e.g./
Maybe also some commas like
    ..., e.g. "git checkout <TAB>", ...
Or maybe it should be “i.e.”?
Show 11 quoted lines
> This commit adds a new config var to allow setting
> a custom ordering, the conf value will be used
> for the --sort=<val> of for-each-ref.
>
> When a custom ordering is not set then alphabetical
> default is kept, but this time is explicit as we
> pass --sort='refname'
>
> This commit also adds '-o nosort' to 'complete'
> to disable its default alphabetical ordering so
> our custom ordering prevails.

Super nitpick: the paragraphs could be wrapped closer to 72 characters/ columns.[2][3] This alternative (slightly modified) is closer to that yet not very uneven, still.

    Previously when completing refs eg. "git checkout <TAB>" all refs
    were alphabetically ordered, this was an implicit ordering and could
    not be changed.
    This commit adds a new config var to allow setting a custom ordering,
    the conf value will be used for the --sort=<val> of for-each-ref.
    When a custom ordering is not set then alphabetical default is kept,
    but this time is explicit as we pass --sort='refname'
    This commit also adds '-o nosort' to 'complete' to disable its default
    alphabetical ordering so our custom ordering prevails.
> This commit also adds '-o nosort' to 'complete'

“This commit” should be replaced with just the imperative style “Also add”.[1]

† 1: See Documentation/SubmittingPatches, “imperative-mood” 🔗 2: https://lore.kernel.org/git/CAPig+cT1VfY8QiUvrrV3-obTBP1439b6iwaebJtGwML5MScnQA@mail.gmail.com/

-- 
cheers 

Kristoffer Haugsbakk
Previous: D. Ben KnobleNext: D. Ben Knoble
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 Benítez León, Jun 8, 2025
  2. D. Ben KnobleJun 27, 2025
  3. Kristoffer HaugsbakkJun 27, 2025
  4. D. Ben KnobleJun 27, 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.