Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ pub struct GitGraph {
pub indices: HashMap<Oid, usize>,
/// All detected branches and tags, including merged and deleted
pub all_branches: Vec<BranchInfo>,
/// Indices of all real (still existing) branches in `all_branches`
pub branches: Vec<usize>,
/// Indices of all tags in `all_branches`
pub tags: Vec<usize>,
/// The current HEAD
pub head: HeadInfo,
}
Expand Down Expand Up @@ -155,37 +151,11 @@ impl GitGraph {
}
}

let branches = all_branches
.iter()
.enumerate()
.filter_map(|(idx, br)| {
if !br.is_merged && !br.is_tag {
Some(idx)
} else {
None
}
})
.collect();

let tags = all_branches
.iter()
.enumerate()
.filter_map(|(idx, br)| {
if !br.is_merged && br.is_tag {
Some(idx)
} else {
None
}
})
.collect();

Ok(GitGraph {
repository,
commits: filtered_commits,
indices: filtered_indices,
all_branches,
branches,
tags,
head,
})
}
Expand Down
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
//! 2. Lay out the graph structure according to the branching model (See [graph])
//! 3. Render the layout to text or SVG (See [mod@print])

/* TODO git-graph has some complex functions, which make it hard to
understand and modify the code. The code should be made simpler
so the following warnings can be enabled without triggering.

// Configure clippy to look for complex functions
#![warn(clippy::cognitive_complexity)]
#![warn(clippy::too_many_lines)]
*/

use git2::Repository;
use std::path::Path;

Expand Down
Loading