@@ -23,6 +23,7 @@ def __init__(self, scene):
2323 self .hide_first_tag = False
2424 self .stop = False
2525 self .zone_title_offset = 2.6 if platform .system () == "Windows" else 2.6
26+ self .allow_no_commits = False
2627
2728 self .logo = ImageMobject (self .scene .args .logo )
2829 self .logo .width = 3
@@ -43,8 +44,14 @@ def execute(self):
4344
4445 def get_commits (self , start = "HEAD" ):
4546 if not self .numCommits :
46- print ("git-sim error: No commits in current Git repository." )
47- sys .exit (1 )
47+ if self .allow_no_commits :
48+ self .numCommits = self .defaultNumCommits
49+ self .commits = ["dark" ]* 5
50+ self .zone_title_offset = 2
51+ return
52+ else :
53+ print ("git-sim error: No commits in current Git repository." )
54+ sys .exit (1 )
4855
4956 try :
5057 self .commits = list (self .repo .iter_commits (start )) if self .numCommits == 1 else list (self .repo .iter_commits (start + "~" + str (self .numCommits ) + "..." + start ))
@@ -416,9 +423,14 @@ def populate_zones(self, firstColumnFileNames, secondColumnFileNames, thirdColum
416423 if "git-sim_media" not in x .a_path :
417424 secondColumnFileNames .add (x .a_path )
418425
419- for y in self .repo .index .diff ("HEAD" ):
420- if "git-sim_media" not in y .a_path :
421- thirdColumnFileNames .add (y .a_path )
426+ try :
427+ for y in self .repo .index .diff ("HEAD" ):
428+ if "git-sim_media" not in y .a_path :
429+ thirdColumnFileNames .add (y .a_path )
430+ except git .exc .BadName :
431+ for (y , _stage ), entry in self .repo .index .entries .items ():
432+ if "git-sim_media" not in y :
433+ thirdColumnFileNames .add (y )
422434
423435 for z in self .repo .untracked_files :
424436 if "git-sim_media" not in z :
0 commit comments