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

Re: [PATCH v4] ref-filter: fallback on alphabetical comparison

From
Johannes Sixt <j6t@kdbg.org>
Date
Oct 30, 2015, 22:51 UTC
Message-ID
<5633F489.60008@kdbg.org>
In-Reply-To
<1446194728-7944-1-git-send-email-Karthik.188@gmail.com>
Am 30.10.2015 um 09:45 schrieb Karthik Nayak:
Show 18 quoted lines
> In ref-filter.c the comparison of refs while sorting is handled by
> cmp_ref_sorting() function. When sorting as per numerical values
> (e.g. --sort=objectsize) there is no fallback comparison when both
> refs hold the same value. This can cause unexpected results (i.e. the
> order of listing refs with equal values cannot be pre-determined) as
> pointed out by Johannes Sixt ($gmane/280117).
>
> Hence, fallback to alphabetical comparison based on the refname
> whenever the other criterion is equal.
>
> A test in t3203 was expecting that branch-two sorts before HEAD, which
> happened to be how qsort(3) on Linux sorted the array, but (1) that
> outcome was not even guaranteed, and (2) once we start breaking ties
> with the refname, "HEAD" should sort before "branch-two" so the
> original expectation was inconsistent with the criterion we now use.
>
> Update it to match the new world order, which we can now depend on
> being stable.

Needless to say that the patch fixes the test failure on Windows. (I tested v2 of the patch.)

-- Hannes
Previous: Karthik NayakNext: Junio C Hamano
Message 2 of 3 in “ref-filter: fallback on alphabetical comparison”
  1. ref-filter: fallback on alphabetical comparisonKarthik Nayak, Oct 30, 2015
  2. Johannes SixtOct 30, 2015
  3. Junio C HamanoOct 30, 2015

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.