-
Notifications
You must be signed in to change notification settings - Fork 0
First serious attempt to fix issue #2 https://github.com/KarlHeitmann/git_explorer/issues/2 #3
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: refactor_explorer
Are you sure you want to change the base?
Conversation
| stop_condition_i: usize, | ||
| stop_conditions: Vec<Option<BranchData>>, | ||
| nodes_len: usize, | ||
| abort: bool, |
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.
Created abort and limit_stack attributes created in GitExplorer struct, the idea is to remove the arguments here. Separate responsibilities, they are not necessary to be as arguments
| // let branches = branches.map(|b| BranchData::new(b)).collect(); | ||
| self.paint_commit_track(self.repo.head().unwrap().peel_to_commit().unwrap(), 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.
These are all the attempts I made to fix the error[0502] I've got when adding the abort and limit_stack attributes to GitExplorer struct. (lines 177 to 197)
| mut output: Vec<GraphNode>, | ||
| limit_stack: Option<usize>, | ||
| branches: Vec<BranchData>, | ||
| abort: bool) -> Vec<GraphNode> { |
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.
limit_stack and abort attributes are not necessary as arguments. I can use them from the GitExplorer struct if I define them as attributes of that struct.
|
|
||
| let stop_condition = self.stop_conditions.get(self.stop_condition_i).unwrap(); | ||
| let abort_next = match stop_condition { | ||
| self.abort = match stop_condition { |
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 line will need to mutate GitExplorer instance, and this cascades the error until reaching this point
|
|
||
| fn paint_branch( | ||
| &self, | ||
| &mut self, |
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.
changed immutable reference to self to mutable reference to self. I also need to change mutable reference to self in paint_commit_track
extracts abort and limit_stack that are the abort conditions to stop drawing the git graph as params to the function, and uses it as attributes of the
GitExplorerstruct