Skip to content

Commit a157af1

Browse files
Fix display for table/zone subcommands when repo has less than 5 commits
Signed-off-by: Jacob Stopak <jacob@initialcommit.io>
1 parent 8b3405f commit a157af1

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

git_sim/git_sim_base_command.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ def parse_commits(
8282
):
8383
commit = commit or self.get_commit()
8484

85-
isNewCommit = commit.hexsha not in self.drawnCommits
85+
if commit != "dark":
86+
isNewCommit = commit.hexsha not in self.drawnCommits
87+
else:
88+
isNewCommit = True
8689

8790
if i < self.n:
8891
commitId, circle, arrow, hide_refs = self.draw_commit(
@@ -114,7 +117,12 @@ def parse_commits(
114117

115118
self.first_parse = False
116119
i += 1
117-
commitParents = list(commit.parents)
120+
try:
121+
commitParents = list(commit.parents)
122+
except AttributeError:
123+
self.parse_commits(self.create_dark_commit(), i, circle)
124+
return
125+
118126
if len(commitParents) > 0:
119127
if settings.invert_branches:
120128
commitParents.reverse()
@@ -124,6 +132,8 @@ def parse_commits(
124132
else:
125133
for p in range(len(commitParents)):
126134
self.parse_commits(commitParents[p], i, circle)
135+
else:
136+
self.parse_commits(self.create_dark_commit(), i, circle)
127137

128138
def parse_all(self):
129139
if self.all:
@@ -217,7 +227,10 @@ def draw_commit(self, commit, i, prevCircle, shift=numpy.array([0.0, 0.0, 0.0]))
217227
while any((circle.get_center() == c).all() for c in self.get_centers()):
218228
circle.shift(m.DOWN * 4)
219229

220-
isNewCommit = commit.hexsha not in self.drawnCommits
230+
if commit != "dark":
231+
isNewCommit = commit.hexsha not in self.drawnCommits
232+
else:
233+
isNewCommit = True
221234

222235
if isNewCommit:
223236
start = (

0 commit comments

Comments
 (0)