Commits

Yuya Nishihara  committed 3f240b2

filedata: prepend diff header only if diff text is not empty (fixes #2462)

It acted as such before 0041b29c4b8b.

  • Participants
  • Parent commits 6be820e
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/filedata.py

             if isbfile:
                 olddata += '\0'
                 newdata += '\0'
-            self.diff = 'diff -r %s -r %s %s\n' % (ctx, ctx2, oldname)
-            self.diff += mdiff.unidiff(olddata, olddate, newdata, newdate,
-                                       oldname, wfile, opts=diffopts)
+            difftext = mdiff.unidiff(olddata, olddate, newdata, newdate,
+                                     oldname, wfile, opts=diffopts)
+            if difftext:
+                self.diff = ('diff -r %s -r %s %s\n' % (ctx, ctx2, oldname)
+                             + difftext)
+            else:
+                self.diff = ''