Skip to content

Commit 8177cee

Browse files
committed
Fix #67: Commit parent outside scope
1 parent 4ea8ca1 commit 8177cee

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
@@ -42,6 +42,16 @@ pub fn print_svg(graph: &GitGraph, settings: &Settings) -> Result<String, String
4242
continue;
4343
};
4444
let Some(par_idx) = graph.indices.get(&par_oid) else {
45+
// Parent is outside scope of graph.indices
46+
// so draw a vertical line to the bottom
47+
let idx_bottom = max_idx;
48+
document = document.add(line(
49+
idx,
50+
branch.visual.column.unwrap(),
51+
idx_bottom,
52+
branch.visual.column.unwrap(),
53+
branch_color,
54+
));
4555
continue;
4656
};
4757
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
@@ -159,6 +159,16 @@ pub fn print_unicode(graph: &GitGraph, settings: &Settings) -> Result<UnicodeGra
159159
continue;
160160
};
161161
let Some(par_idx) = graph.indices.get(&par_oid) else {
162+
// Parent is outside scope of graph.indices
163+
// so draw a vertical line to the bottom
164+
let idx_bottom = grid.height;
165+
vline(
166+
&mut grid,
167+
(idx_map, idx_bottom),
168+
column,
169+
branch_color,
170+
branch.persistence,
171+
);
162172
continue;
163173
};
164174

0 commit comments

Comments
 (0)