Skip to content

Commit 1d2e1ea

Browse files
committed
Fix #67: Commit parent outside scope
1 parent 6580b6a commit 1d2e1ea

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/print/svg.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ pub fn print_svg(graph: &GitGraph, settings: &Settings) -> Result<String, String
4141
continue;
4242
};
4343
let Some(par_idx) = graph.indices.get(par_oid) else {
44+
// Parent is outside scope of graph.indices
45+
// so draw a vertical line to the bottom
46+
let idx_bottom = max_idx;
47+
document = document.add(line(
48+
idx,
49+
branch.visual.column.unwrap(),
50+
idx_bottom,
51+
branch.visual.column.unwrap(),
52+
branch_color,
53+
));
4454
continue;
4555
};
4656
let par_info = &graph.commits[*par_idx];

src/print/unicode.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,16 @@ pub fn print_unicode(graph: &GitGraph, settings: &Settings) -> Result<UnicodeGra
158158
continue;
159159
};
160160
let Some(par_idx) = graph.indices.get(par_oid) else {
161+
// Parent is outside scope of graph.indices
162+
// so draw a vertical line to the bottom
163+
let idx_bottom = grid.height;
164+
vline(
165+
&mut grid,
166+
(idx_map, idx_bottom),
167+
column,
168+
branch_color,
169+
branch.persistence,
170+
);
161171
continue;
162172
};
163173

0 commit comments

Comments
 (0)