-
Notifications
You must be signed in to change notification settings - Fork 9
Adds a config option to sort branch list by most recent commit date #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds a config option to sort branch list by most recent commit date #84
Conversation
|
Does a config option make sense for this ? |
|
Will need to think through how to fix the Clippy warning about there being too many boolean values in the Options struct. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love this idea!
Does a config option make sense for this ?
Or should it be a flag (don't know if we have a notion of flags yet) ?
I think, even if we had a notion of flags, a config option would still be the right choice (and you could override it later with a flag). Flags are not supported yet because I haven't given them enough thought -- there are some problems with the way it's done in Magit (imho) that I would like to see about addressing
Will need to think through how to fix the Clippy warning about there being too many boolean values in the Options struct.
This lint exists because Clippy thinks you might be trying to make a state machine. It's not the case here, so you can ignore the lint. (you can make the lint pass by adding #[allow(clippy::struct_excessive_bools)] to the struct.
Looking at the git documentation, it seems a number of keys can be provided, where the default is refname. How would you feel about making this config field a string instead, where the user can just provide a key for this argment?
E.g.:
sort_branches = "refname"sort_branches = "-committerdate"
This makes sense to me. It expands the utility of this PR. How do we make it clear what the possible values that you can pass to this option are (comment next to the readme entry ? ) ? |
Would love to hear more about this (would be better to do it in a discussion post). |
Sounds good. I think it would be enough for now to just link to the git documentation.
Seems reasonable to me. I would say if the call to git returns non-zero exit code then fallback to Alternatively, you could reject the key at the time the config is parsed. This will mean the error is caught before the branch list is ever opened, but arguably would be less stable in case git changes its API (though I think this is rare) |
| if output.status.success() { | ||
| output | ||
| } else { | ||
| MiniBuffer::push_command_output(&output); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will show the error right when someone opens up gex. Also the error message isn't very informative. It just says "unknown field name: {whatever you passed into sort_branches}"
Piturnah
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks great! Thanks for your contribution!
|
Released in 0.6.4 🎉 |
Solution for #79.
Adds a config option,
sort_branch_list_by_commit_date, with a default value of false, that will allow users to sort the branch list on the checkout screen by most recent commit date.