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
This commit is contained in:
Junio C Hamano 2015-11-03 15:12:55 -08:00
commit 415095f055
2 changed files with 2 additions and 2 deletions

View file

@ -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;
}

View file

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