Skip to content
  • epriestley's avatar
    Extract raw commit messages from Git more faithfully across Git versions · 785f3c98
    epriestley authored
    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.
    
    Maniphest Tasks: T5028
    
    Differential Revision: https://secure.phabricator.com/D21027
    785f3c98