Page MenuHomePhabricator

Extract raw commit messages from Git more faithfully across Git versions
ClosedPublic

Authored by epriestley on Feb 24 2020, 7:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 18, 1:58 PM
Unknown Object (File)
Mon, Dec 9, 11:45 PM
Unknown Object (File)
Fri, Dec 6, 5:30 AM
Unknown Object (File)
Mon, Dec 2, 12:57 AM
Unknown Object (File)
Fri, Nov 29, 3:59 AM
Unknown Object (File)
Thu, Nov 28, 1:32 PM
Unknown Object (File)
Sun, Nov 24, 9:25 AM
Unknown Object (File)
Sat, Nov 23, 9:13 AM
Subscribers
None

Details

Summary

Fixes T5028. Older versions of Git (apparently, from before 2010) did not provide a way to extract the raw body of a commit message from "git log", so we approximate it with "subject" and "wrapped body".

In newer versions of Git, the raw body can be extracted exactly.

Adjust how we extract messages based on the version of Git, and try to be more faithful to edge cases: particularly, be more careful to extract the correct number of trailing newlines.

Test Plan
  • Added "var_dump()" + "die(1)" later in this method, then pushed various commit messages. Used "&& false" to force execution down the old path (either path should work in modern Git).
  • Observed more faithful extraction of messages, including a more faithful extraction of the number of trailing newlines. Extraction is fully faithful if we can go down the "%B" path, which we should be able to in nearly all modern cases.
  • Not all messages extract faithfully or consistently across the old and new versions, but the old extraction is destructive so this is likely about as close as we can realistically ever get.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable