@@ -101,7 +101,9 @@ def construct(self):
101
101
self .show_outro ()
102
102
103
103
def get_commit (self , sha_or_ref = "HEAD" ):
104
- return self .repo .commit (sha_or_ref )
104
+ if self .head_exists ():
105
+ return self .repo .commit (sha_or_ref )
106
+ return "dark"
105
107
106
108
def get_default_commits (self ):
107
109
defaultCommits = [self .get_commit ()]
@@ -646,7 +648,9 @@ def setup_and_draw_zones(
646
648
reverse = False ,
647
649
):
648
650
if self .check_all_dark ():
649
- self .zone_title_offset = 2.0 if platform .system () == "Windows" else 6.0
651
+ self .zone_title_offset = 2.0 if platform .system () == "Windows" else 2.0
652
+ elif len (self .drawnCommits ) == 1 :
653
+ self .zone_title_offset = 2.0 if platform .system () == "Windows" else 2.0
650
654
651
655
horizontal = m .Line (
652
656
(
@@ -928,6 +932,9 @@ def populate_zones(
928
932
firstColumnFileNames .add (z )
929
933
930
934
def center_frame_on_commit (self , commit ):
935
+ if not commit or commit == "dark" :
936
+ return
937
+
931
938
if settings .animate :
932
939
self .play (
933
940
self .camera .frame .animate .move_to (
@@ -938,6 +945,9 @@ def center_frame_on_commit(self, commit):
938
945
self .camera .frame .move_to (self .drawnCommits [commit .hexsha ].get_center ())
939
946
940
947
def reset_head_branch (self , hexsha , shift = numpy .array ([0.0 , 0.0 , 0.0 ])):
948
+ if not self .head_exists ():
949
+ return
950
+
941
951
if settings .animate :
942
952
self .play (
943
953
self .drawnRefs ["HEAD" ].animate .move_to (
@@ -1046,25 +1056,28 @@ def setup_and_draw_parent(
1046
1056
fill_opacity = self .ref_fill_opacity ,
1047
1057
)
1048
1058
circle .height = 1
1049
- circle .next_to (
1050
- self .drawnCommits [child .hexsha ],
1051
- m .LEFT if settings .reverse else m .RIGHT ,
1052
- buff = 1.5 ,
1053
- )
1059
+ if child != "dark" :
1060
+ circle .next_to (
1061
+ self .drawnCommits [child .hexsha ],
1062
+ m .LEFT if settings .reverse else m .RIGHT ,
1063
+ buff = 1.5 ,
1064
+ )
1065
+
1054
1066
circle .shift (shift )
1055
1067
1056
- start = circle .get_center ()
1057
- end = self .drawnCommits [child .hexsha ].get_center ()
1058
- arrow = m .Arrow (
1059
- start ,
1060
- end ,
1061
- color = self .fontColor ,
1062
- stroke_width = self .arrow_stroke_width ,
1063
- tip_shape = self .arrow_tip_shape ,
1064
- max_stroke_width_to_length_ratio = 1000 ,
1065
- )
1066
- length = numpy .linalg .norm (start - end ) - (1.5 if start [1 ] == end [1 ] else 3 )
1067
- arrow .set_length (length )
1068
+ if child != "dark" :
1069
+ start = circle .get_center ()
1070
+ end = self .drawnCommits [child .hexsha ].get_center ()
1071
+ arrow = m .Arrow (
1072
+ start ,
1073
+ end ,
1074
+ color = self .fontColor ,
1075
+ stroke_width = self .arrow_stroke_width ,
1076
+ tip_shape = self .arrow_tip_shape ,
1077
+ max_stroke_width_to_length_ratio = 1000 ,
1078
+ )
1079
+ length = numpy .linalg .norm (start - end ) - (1.5 if start [1 ] == end [1 ] else 3 )
1080
+ arrow .set_length (length )
1068
1081
1069
1082
commitId = m .Text (
1070
1083
"abcdef" ,
@@ -1102,7 +1115,7 @@ def setup_and_draw_parent(
1102
1115
self .drawnCommits ["abcdef" ] = circle
1103
1116
self .toFadeOut .add (circle )
1104
1117
1105
- if draw_arrow :
1118
+ if draw_arrow and child != "dark" :
1106
1119
if settings .animate :
1107
1120
self .play (m .Create (arrow ), run_time = 1 / settings .speed )
1108
1121
else :
0 commit comments