summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/lib/oe/patch.py28
1 files changed, 23 insertions, 5 deletions
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
index c04f098712..0332f100f1 100644
--- a/meta/lib/oe/patch.py
+++ b/meta/lib/oe/patch.py
@@ -351,6 +351,21 @@ class GitApplyTree(PatchTree):
351 # We don't want the From <commit> line - if it's present it will break rebasing 351 # We don't want the From <commit> line - if it's present it will break rebasing
352 continue 352 continue
353 outlines.append(line) 353 outlines.append(line)
354
355 if not subject:
356 firstline = None
357 for line in headerlines:
358 line = line.strip()
359 if firstline:
360 if line:
361 # Second line is not blank, the first line probably isn't usable
362 firstline = None
363 break
364 elif line:
365 firstline = line
366 if firstline and not firstline.startswith(('#', 'Index:', 'Upstream-Status:')) and len(firstline) < 100:
367 subject = firstline
368
354 return outlines, author, date, subject 369 return outlines, author, date, subject
355 370
356 @staticmethod 371 @staticmethod
@@ -373,21 +388,24 @@ class GitApplyTree(PatchTree):
373 # Process patch header and extract useful information 388 # Process patch header and extract useful information
374 lines = GitApplyTree.extractPatchHeader(patchfile) 389 lines = GitApplyTree.extractPatchHeader(patchfile)
375 outlines, author, date, subject = GitApplyTree.interpretPatchHeader(lines) 390 outlines, author, date, subject = GitApplyTree.interpretPatchHeader(lines)
376 if not author or not subject: 391 if not author or not subject or not date:
377 try: 392 try:
378 shellcmd = ["git", "log", "--format=email", "--diff-filter=A", "--", patchfile] 393 shellcmd = ["git", "log", "--format=email", "--follow", "--diff-filter=A", "--", patchfile]
379 out = runcmd(["sh", "-c", " ".join(shellcmd)], os.path.dirname(patchfile)) 394 out = runcmd(["sh", "-c", " ".join(shellcmd)], os.path.dirname(patchfile))
380 except CmdError: 395 except CmdError:
381 out = None 396 out = None
382 if out: 397 if out:
383 _, newauthor, newdate, newsubject = GitApplyTree.interpretPatchHeader(out.splitlines()) 398 _, newauthor, newdate, newsubject = GitApplyTree.interpretPatchHeader(out.splitlines())
384 if not author or not date: 399 if not author:
385 # These really need to go together 400 # If we're setting the author then the date should be set as well
386 author = newauthor 401 author = newauthor
387 date = newdate 402 date = newdate
403 elif not date:
404 # If we don't do this we'll get the current date, at least this will be closer
405 date = newdate
388 if not subject: 406 if not subject:
389 subject = newsubject 407 subject = newsubject
390 if subject: 408 if subject and outlines and not outlines[0].strip() == subject:
391 outlines.insert(0, '%s\n\n' % subject.strip()) 409 outlines.insert(0, '%s\n\n' % subject.strip())
392 410
393 # Write out commit message to a file 411 # Write out commit message to a file