Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2411055

Browse files
Fix differences in number of commits between forward and reverse directions
1 parent bff3496 commit 2411055

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎git_story/git_story.py‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ def construct(self):
4949
self.children.setdefault(parent.hexsha, []).append(commit)
5050
z += 1
5151

52+
for d in self.children:
53+
if ( len(self.children[d]) > 1 ):
54+
self.children[d].reverse()
55+
5256
commit = self.commits[0]
5357

5458
logo = ImageMobject(self.args.logo)
@@ -100,7 +104,7 @@ def construct(self):
100104
self.wait(3)
101105

102106
def parseCommits(self, commit, i, prevCircle, toFadeOut, offset):
103-
if ( i < self.args.commits ):
107+
if ( i < self.args.commits andcommitinself.commits):
104108

105109
if ( len(commit.parents) <= 1 ):
106110
commitFill = RED
@@ -148,8 +152,8 @@ def parseCommits(self, commit, i, prevCircle, toFadeOut, offset):
148152

149153
commitId = Text(commit.hexsha[0:6], font="Monospace", font_size=20, color=self.fontColor).next_to(circle, UP)
150154

151-
commit.message = commit.message.replace("\n", " ")
152-
message = Text('\n'.join(commit.message[j:j+20] for j in range(0, len(commit.message), 20))[:100], font="Monospace", font_size=14, color=self.fontColor).next_to(circle, DOWN)
155+
commitMessage = commit.message[:40].replace("\n", " ")
156+
message = Text('\n'.join(commitMessage[j:j+20] for j in range(0, len(commitMessage), 20))[:100], font="Monospace", font_size=14, color=self.fontColor).next_to(circle, DOWN)
153157

154158
if ( isNewCommit ):
155159
self.play(Create(circle), AddTextLetterByLetter(commitId), AddTextLetterByLetter(message))
@@ -219,7 +223,7 @@ def parseCommits(self, commit, i, prevCircle, toFadeOut, offset):
219223
if ( self.args.reverse ):
220224
if ( len(commit.parents) > 0 ):
221225
if ( self.args.hide_merged_chains ):
222-
self.parseCommits(commit.parents[0], i+1, prevCircle, toFadeOut, False)
226+
self.parseCommits(commit.parents[0], i+1, prevCircle, toFadeOut, False)
223227
else:
224228
for p in range(len(commit.parents)):
225229
self.parseCommits(commit.parents[p], i+1, prevCircle, toFadeOut, False if ( p == 0 ) else True)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /