Skip to content

Conversation

@KarlHeitmann
Copy link
Owner

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 GitExplorer struct

stop_condition_i: usize,
stop_conditions: Vec<Option<BranchData>>,
nodes_len: usize,
abort: bool,
Copy link
Owner Author

@KarlHeitmann KarlHeitmann Mar 22, 2023

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)

/*
Copy link
Owner Author

@KarlHeitmann KarlHeitmann Mar 22, 2023

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> {
Copy link
Owner Author

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 {
Copy link
Owner Author

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,
Copy link
Owner Author

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

@KarlHeitmann KarlHeitmann changed the title wip First serious attempt to fix #2 Mar 22, 2023
@KarlHeitmann KarlHeitmann changed the title First serious attempt to fix #2 First serious attempt to fix issue [#2](https://github.com/KarlHeitmann/git_explorer/issues/2) Mar 22, 2023
@KarlHeitmann KarlHeitmann changed the title First serious attempt to fix issue [#2](https://github.com/KarlHeitmann/git_explorer/issues/2) First serious attempt to fix issue #2 https://github.com/KarlHeitmann/git_explorer/issues/2 Mar 22, 2023
@KarlHeitmann KarlHeitmann added the help wanted Extra attention is needed label Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wanted Extra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants