Commits

Michele Bini committed ec38b98

Fix handling of shallow repositories

  • Participants
  • Parent commits 46e9aa4

Comments (0)

Files changed (1)

   c = q+commit.sha+q
   last = true
   commit.parents.each do |p|
-    psha = p.sha
-    lsha = sha + psha
-    next if @links.member?(lsha)
-    last = false
-    @links[lsha] = nil
-    d = p.diff(commit)
-    edgeopts = { }
-    edgeopts['color'] = '"white"'
-    edgeopts['fontcolor'] = '"white"'
-    if (d.size > 1)
-      d = sprintf("%d files\\n%d new lines\\n%d deleted", d.size, d.insertions, d.deletions);
-    elsif (d.size == 1)
-      d = sprintf("%s\\n%d new lines\\n%d deleted", d.first.path, d.insertions, d.deletions);      
-    else
-      d = "No\\nchanges";
+    begin
+      psha = p.sha
+      lsha = sha + psha
+      next if @links.member?(lsha)
+      last = false
+      @links[lsha] = nil
+      d = p.diff(commit)
+      edgeopts = { }
+      edgeopts['color'] = '"white"'
+      edgeopts['fontcolor'] = '"white"'
+      if (d.size > 1)
+        d = sprintf("%d files\\n%d new lines\\n%d deleted", d.size, d.insertions, d.deletions);
+      elsif (d.size == 1)
+        d = sprintf("%s\\n%d new lines\\n%d deleted", d.first.path, d.insertions, d.deletions);      
+      else
+        d = "No\\nchanges";
+      end
+      edgeopts['label'] = q + d + q
+      puts q+p.sha+q + " -> " + c + " [#{renderopt(edgeopts)}]"
+    rescue Git::GitExecuteError => x
+      next
     end
-    edgeopts['label'] = q + d + q
-    puts q+p.sha+q + " -> " + c + " [#{renderopt(edgeopts)}]"
   end
   !last
 end