Skip to content

RFC-822-style header behavior enhancements

Eric Sunshine requested to merge sunshineco/src:es/headers into master

The RFC-822-style headers prepended to the commit comment by src fast-import to preserve metadata not otherwise representable in SRC cause problems for src list and src log, and are underutilized, when present. This series fixes the problems and takes advantage of the headers to enhance existing operations. Specifically:

  • src list displays the first line of the commit comment, which is typically a summary of changes, however, headers are prepended by fast-import, which makes src list uselessly display the Author: header unconditionally:

    % src list example.txt
    = example.txt ==========
    2 * <date> Author: Theodore Geisel <cat@hat.com>
    1 - <date> Author: Theodore Geisel <cat@hat.com>

    This series restores the expected behavior of showing the commit comment summary line.

  • src log output is overly noisy when headers are present; this series suppresses display of the headers by default and teaches src log a -v option to re-enable them.

  • SRC tracks only a single date, the so-called commit date, which src list and src log display. However, for histories imported via src fast-import, it is not uncommon for many commits to share the same commit date.

    This situation can arise easily, for instance, when a project maintainer bulk-applies a series of patches (with, say, git am patches.mbox), in which case most or all commits will have the same commit timestamp. Likewise, in Git, rebasing can set the committer timestamp of many commits to the same value. For example, given git rebase -i HEAD~50, after commit HEAD~50 is edited, the committer timestamp of the remaining 49 commits will likely have the same value when replayed atop HEAD~50.

    For this reason, committer date is not typically considered interesting, and tools prefer to instead show author date, by default. For instance, git log --format=short, ... -format=medium, and gitk all default to showing the author, rather than the committer date. This series changes src list and src log to follow suit, showing the author date, rather than committer, if the author date is available in the RFC-822-style headers. (For commits made directly in SRC, those headers are not present, so commit date is shown as usual.)

  • Improve src fast-import / src fast-export roundtrip fidelity by taking advantage of author and committer information and timestamps in the RFC-822-style headers, if present, rather than using only the commit date and unconditionally assigning the person running fast-export as both the author and committer.

Edited by Eric Sunshine

Merge request reports