threads / rfc / 49111

[RFC] implement branch.sort config option

Subject: [RFC] implement branch.sort config option

## tl;dr

3 messages between Aug 13, 2018 and Aug 13, 2018.

replies: 2people: 3as markdown or json

Samuel Maftoul· Aug 13, 2018, 09:56 UTC · lore
Currently, you can:
git tag --sort=$sorting_key
You can also do this on branches:
git branch --sort=$sorting_key
For tags, you can also configure it with a config key:
git config tag.sort $sorting_key
But there is no corresponding config for sorting branches.
Locally, I have a (pretty simple) patch that implements the
branch.sort config key.
Should I contribute that ?
Judging the number of votes and the complexity of answers to this
question https://stackoverflow.com/questions/5188320/how-can-i-get-a-list-of-git-branches-ordered-by-most-recent-commit,
 I would say it's a wanted and useful feature.
I'm still missing tests and docs, but if agreed the feature is useful,
I will write them.
Thanks
Jeff King· Aug 13, 2018, 17:46 UTC · re: Samuel Maftoul · lore

Re: [RFC] implement branch.sort config option

On Mon, Aug 13, 2018 at 11:56:58AM +0200, Samuel Maftoul wrote:
Show 17 quoted lines
> Currently, you can:
> 
> git tag --sort=$sorting_key
> 
> You can also do this on branches:
> 
> git branch --sort=$sorting_key
> 
> For tags, you can also configure it with a config key:
> 
> git config tag.sort $sorting_key
> 
> But there is no corresponding config for sorting branches.
> 
> Locally, I have a (pretty simple) patch that implements the
> branch.sort config key.
> Should I contribute that ?

Yes, that seems like a useful feature to me, and as you point out it makes the overall interface more consistent.

-Peff
Junio C Hamano· Aug 13, 2018, 19:18 UTC · re: Samuel Maftoul · lore

Re: [RFC] implement branch.sort config option

Samuel Maftoul <samuel.maftoul@gmail.com> writes:
> I'm still missing tests and docs, but if agreed the feature is useful,
> I will write them.

I personally think branch.sort would have about the same value as the existing tag.sort, so if a patch is done well, it is likely that users would find it valuable, but let's leave the final judgement until we actually see the completed patch first.

Thanks.

← back to recent threads