File tree Expand file tree Collapse file tree 2 files changed +14
-20
lines changed
gitoxide-core/src/repository Expand file tree Collapse file tree 2 files changed +14
-20
lines changed Original file line number Diff line number Diff line change @@ -5,21 +5,6 @@ pub enum Kind {
55 All ,
66}
77
8- impl Kind {
9- fn includes_local_branches ( & self ) -> bool {
10- match self {
11- Self :: Local | Self :: All => true ,
12- }
13- }
14-
15- fn includes_remote_branches ( & self ) -> bool {
16- match self {
17- Self :: Local => false ,
18- Self :: All => true ,
19- }
20- }
21- }
22-
238pub struct Options {
249 pub kind : Kind ,
2510}
@@ -36,7 +21,12 @@ pub fn list(
3621
3722 let platform = repo. references ( ) ?;
3823
39- if options. kind . includes_local_branches ( ) {
24+ let ( show_local, show_remotes) = match options. kind {
25+ Kind :: Local => ( true , false ) ,
26+ Kind :: All => ( true , true ) ,
27+ } ;
28+
29+ if show_local {
4030 let mut branch_names: Vec < String > = platform
4131 . local_branches ( ) ?
4232 . flatten ( )
@@ -50,7 +40,7 @@ pub fn list(
5040 }
5141 }
5242
53- if options . kind . includes_remote_branches ( ) {
43+ if show_remotes {
5444 let mut branch_names: Vec < String > = platform
5545 . remote_branches ( ) ?
5646 . flatten ( )
Original file line number Diff line number Diff line change @@ -511,10 +511,14 @@ pub fn main() -> Result<()> {
511511 ) ,
512512 Subcommands :: Branch ( platform) => match platform. cmds {
513513 Some ( branch:: Subcommands :: List ) | None => {
514- use core:: repository:: branch:: { Kind , Options } ;
514+ use core:: repository:: branch;
515515
516- let kind = if platform. all { Kind :: All } else { Kind :: Local } ;
517- let options = Options { kind } ;
516+ let kind = if platform. all {
517+ branch:: Kind :: All
518+ } else {
519+ branch:: Kind :: Local
520+ } ;
521+ let options = branch:: Options { kind } ;
518522
519523 prepare_and_run (
520524 "branch-list" ,
You can’t perform that action at this time.
0 commit comments