diff --git a/Cargo.lock b/Cargo.lock index 3d683a9..544f1e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -156,7 +156,7 @@ dependencies = [ [[package]] name = "git-graph" -version = "0.4.2" +version = "0.4.3" dependencies = [ "atty", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 8c18150..5c40678 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "git-graph" -version = "0.4.2" +version = "0.4.3" authors = ["Martin Lange "] description = "Command line tool to show clear git graphs arranged for your branching model" repository = "https://github.com/mlange-42/git-graph.git" diff --git a/src/graph.rs b/src/graph.rs index ac9cf1f..1bc234b 100644 --- a/src/graph.rs +++ b/src/graph.rs @@ -639,8 +639,13 @@ fn extract_branches( for (oid, name) in tags { let name = std::str::from_utf8(&name[5..]).map_err(|err| err.to_string())?; - if let Ok(tag) = repository.find_tag(oid) { - if let Some(target_index) = indices.get(&tag.target_id()) { + let target = repository + .find_tag(oid) + .map(|tag| tag.target_id()) + .or_else(|_| repository.find_commit(oid).map(|_| oid)); + + if let Ok(target_oid) = target { + if let Some(target_index) = indices.get(&target_oid) { counter += 1; let term_col = to_terminal_color( &branch_color( @@ -658,7 +663,7 @@ fn extract_branches( counter, ); let tag_info = BranchInfo::new( - tag.target_id(), + target_oid, None, name.to_string(), settings.branches.persistence.len() as u8 + 1,