File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed
Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -48,17 +48,14 @@ pub(super) fn command() -> clap::Command {
4848}
4949
5050pub ( super ) fn dispatch ( repo : & gix:: Repository , matches : & clap:: ArgMatches ) -> Result < ( ) > {
51- let ( target_branch, target_branchname) = if let Some ( branch_loc) = matches. get_one :: < BranchLocator > ( "branch-any" ) {
52- let branch = branch_loc. resolve ( repo) ?;
53- let branchname = branch. get_branch_partial_name ( ) ?;
54- ( branch, branchname)
51+ let target_branch = if let Some ( branch_loc) = matches. get_one :: < BranchLocator > ( "branch-any" ) {
52+ branch_loc. resolve ( repo) ?
5553 } else if let Ok ( branch) = repo. get_current_branch ( ) {
56- let branchname = branch. get_branch_partial_name ( ) ?;
57- ( branch, branchname)
54+ branch
5855 } else {
5956 return Err ( anyhow ! ( "no target branch specified and no current branch" ) ) ;
6057 } ;
61-
58+ let target_branchname = target_branch . get_branch_partial_name ( ) ? ;
6259 let current_branch = repo. get_current_branch ( ) . ok ( ) ;
6360 let current_branchname = current_branch
6461 . as_ref ( )
Original file line number Diff line number Diff line change @@ -91,8 +91,12 @@ impl<'repo> Stack<'repo> {
9191 // It is ok if the StGit-specific config section does not exist.
9292 let mut local_config_file = repo. local_config_file ( ) ?;
9393 let section = format ! ( "{branch_name}.stgit" ) ;
94- if local_config_file. remove_section ( "branch" , Some ( section. as_bytes ( ) . into ( ) ) ) . is_some ( ) {
95- repo. write_local_config ( local_config_file) . context ( "writing local config" ) ?;
94+ if local_config_file
95+ . remove_section ( "branch" , Some ( section. as_bytes ( ) . into ( ) ) )
96+ . is_some ( )
97+ {
98+ repo. write_local_config ( local_config_file)
99+ . context ( "writing local config" ) ?;
96100 }
97101
98102 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments