summaryrefslogtreecommitdiff
path: root/t/t3203-branch-output.sh
diff options
context:
space:
mode:
authorKarthik Nayak <karthik.188@gmail.com>2015-10-30 14:15:28 +0530
committerJunio C Hamano <gitster@pobox.com>2015-10-30 13:50:52 -0700
commit9e468334b41c1d1fc715de177ef1f61a36c1cf01 (patch)
tree5861b609930bbfe709c1f8f09bceb2b2fe570d1a /t/t3203-branch-output.sh
parentaa3bc55e408d4daab52239d6b80f7d4bb87f6de7 (diff)
downloadgit-9e468334b41c1d1fc715de177ef1f61a36c1cf01.tar.gz
ref-filter: fallback on alphabetical comparisonkn/for-each-branch
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. Helped-by: Junio C Hamano <gitster@pobox.com> Reported-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Karthik Nayak <Karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3203-branch-output.sh')
-rwxr-xr-xt/t3203-branch-output.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh
index f1ae5ff662..2aa199607e 100755
--- a/t/t3203-branch-output.sh
+++ b/t/t3203-branch-output.sh
@@ -145,8 +145,8 @@ EOF
test_expect_success 'git branch `--sort` option' '
cat >expect <<-\EOF &&
- branch-two
* (HEAD detached from fromtag)
+ branch-two
branch-one
master
EOF