##// END OF EJS Templates
Don't generate git diff header for empty diffs
Brendan Cully -
r3329:319358e6 default
parent child Browse files
Show More
@@ -467,6 +467,7 b' def diff(repo, node1=None, node2=None, f'
467 467 to = None
468 468 tn = None
469 469 dodiff = True
470 header = []
470 471 if f in mmap:
471 472 to = getfile(f).read(mmap[f])
472 473 if f not in removed:
@@ -480,7 +481,6 b' def diff(repo, node1=None, node2=None, f'
480 481 header.append('new mode %s\n' % nmode)
481 482
482 483 a, b = f, f
483 header = []
484 484 if f in added:
485 485 if node2:
486 486 mode = gitmode(mmap2.execf(f))
@@ -510,11 +510,12 b' def diff(repo, node1=None, node2=None, f'
510 510 nmode = gitmode(util.is_exec(repo.wjoin(f), mmap.execf(f)))
511 511 addmodehdr(header, omode, nmode)
512 512 r = None
513 if dodiff:
514 header.insert(0, 'diff --git a/%s b/%s\n' % (a, b))
513 header.insert(0, 'diff --git a/%s b/%s\n' % (a, b))
514 if dodiff:
515 text = mdiff.unidiff(to, date1, tn, date2(f), f, r, opts=opts)
516 if text or len(header) > 1:
515 517 fp.write(''.join(header))
516 if dodiff:
517 fp.write(mdiff.unidiff(to, date1, tn, date2(f), f, r, opts=opts))
518 fp.write(text)
518 519
519 520 def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False,
520 521 opts=None):
General Comments 0
You need to be logged in to leave comments. Login now