-
-
Notifications
You must be signed in to change notification settings - Fork 608
Feature #875: Delete referring branches #935
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
base: master
Are you sure you want to change the base?
Feature #875: Delete referring branches #935
Conversation
After deleting a branch, check if there are any upstream / tracking branches and ask if user wants to delete them as well.
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.
also please undo the function split up and silence the too-many-lines warning for now via a annotation. we should do refactorings as separat changes
- Adding tests of `get_branch_trackers` in the existing unittests - Adding clippy annotations to disable "too many lines" error on `process_confirmed_action` - Fixing upstream ref string when deleting a local branch
Hello @extrawurst, thanks for the quick review and suggestions. I've just updated the PR with the following:
|
@@ -582,6 +617,28 @@ mod tests_branches { | |||
.unwrap(), | |||
String::from("r2") | |||
); | |||
|
|||
assert_eq!( |
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.
please move these into a separate unittest that is clearly focused on testing only the new get_branch_trackers
fn. even if you copy an existing test but cleanup the assertions that have nothing to do with testing get_branch_trackers
- this should simplify readability for later maintenance
src/app.rs
Outdated
@@ -769,6 +770,21 @@ impl App { | |||
flags.insert(NeedsUpdate::ALL); | |||
} | |||
Action::DeleteBranch(branch_ref, true) => { | |||
let upstream = branch_ref | |||
.rsplit('/') |
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.
lets move this convert ref to branch name code into asyncgit (maybe as a get_branch_remote_by_ref
) to be able to unittest it. I think rsplit is incorrect here. I fixed another issue with this the other day. check out c6abbaf
src/strings.rs
Outdated
branches_ref: &[String], | ||
) -> String { | ||
format!( | ||
"Do you want to delete the referring tracking branches: {} ?", |
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.
since it is a list and we have a multiline message box, lets list the branch names one per line after the question
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.
added a few comments. please bring it up to date with master, I refactored a the branch deletion to better distinguish local vs remote branch delete
- A new method was created in asyncgit to find a upstream branch, given the local branch ref (`get_branch_remote_by_ref`) - Added unit tests for `get_branch_remote_by_ref` and `get_branch_trackers`
I've made the changes requested. |
format!("refs/remotes/{}/{}", remote, self.branch); | ||
Some( | ||
get_branch_trackers(CWD, &remote_ref) | ||
.unwrap_or_else(|_| HashSet::new()) |
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.
why do we need an empty hashset here? can't we go with None in case there was a problem?
marking as |
@alessandroasm are you still planning to move this forward? |
This issue has been automatically marked as stale because it has not had any activity half a year. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
This Pull Request fixes/closes #875.
It changes the following:
I followed the checklist:
make check
without errors