diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-11-03 15:12:55 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-11-03 15:12:57 -0800 |
commit | 415095f05501bb17edcb86c6d9fd193753b30ea7 (patch) | |
tree | ef453673dd4ada7c2b0b355085d8c3086f619a3a | |
parent | Ninth batch for 2.7 (diff) | |
parent | ref-filter: fallback on alphabetical comparison (diff) | |
download | tgif-415095f05501bb17edcb86c6d9fd193753b30ea7.tar.xz |
Merge branch 'kn/for-each-branch'
Using the timestamp based criteria in "git branch --sort" did not
tiebreak branches that point at commits with the same timestamp (or
the same commit), making the resulting output unstable.
* kn/for-each-branch:
ref-filter: fallback on alphabetical comparison
-rw-r--r-- | ref-filter.c | 2 | ||||
-rwxr-xr-x | t/t3203-branch-output.sh | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/ref-filter.c b/ref-filter.c index 1194f10ed6..e205dd2f68 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -1457,7 +1457,7 @@ static int cmp_ref_sorting(struct ref_sorting *s, struct ref_array_item *a, stru if (va->ul < vb->ul) cmp = -1; else if (va->ul == vb->ul) - cmp = 0; + cmp = strcmp(a->refname, b->refname); else cmp = 1; } diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh index 9454423ca0..d3913f9088 100755 --- a/t/t3203-branch-output.sh +++ b/t/t3203-branch-output.sh @@ -158,8 +158,8 @@ EOF test_expect_success 'git branch `--sort` option' ' cat >expect <<-\EOF && - branch-two * (HEAD detached from fromtag) + branch-two branch-one master EOF |