Skip to content

Commit

Permalink
Merge branch 'kn/for-each-branch'
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Junio C Hamano committed Nov 3, 2015
2 parents 2635c2b + 9e46833 commit 415095f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ref-filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion t/t3203-branch-output.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 415095f

Please sign in to comment.