diff options
| author | Shlok Kulshreshtha <diy2903@gmail.com> | 2026-07-27 15:26:56 +0530 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-07-27 12:58:38 -0700 |
| commit | 9539653b71ed1ab37302574f96544013b8829eb9 (patch) | |
| tree | c3b12c8ae9c14b52b08a4ebb851ed9b30b18dd1e /t/t4013/diff.diff_initial..side | |
| parent | a592d6feb3d47a1fcd6be5b4c8136e116c26ffbc (diff) | |
t: use commit_body to extract commit message bodies
Replace the "git cat-file commit | sed" idiom with commit_body across the
test suite: 61 sites in 12 files, plus one local helper that wrapped the
same idiom. The idiom appears in four equivalent spellings -- piped or
written to a file first, "sed -e" or plain "sed", "\$" or "$" in the
address -- all producing byte-identical output; they all collapse to the
same commit_body call.
t7509-commit-authorship.sh defined its own local message_body() helper
around the idiom instead of spelling it out at each call site; remove the
helper and convert its six call sites to commit_body directly.
Two sites needed more than a mechanical substitution:
* t7600.sh ("merge --no-ff --edit") greps the raw commit object for a
phrase before stripping its header for the final comparison. The
phrase is part of the commit body, not the header, so the grep can
run against the already-stripped body instead, letting both steps
share one commit_body call.
* t3900-i18n-commit.sh pipes the stripped body into "iconv" to test
re-encoding. Piping commit_body's output into "iconv" would reintroduce
an exit-code hole one line after removing it elsewhere, so this site
writes the body to a file first and reads that, keeping the &&-chain
intact.
Some greps for sed -e "1,/^\*$/d" left unconverted, as they are not extracting a commit's message body:
* t9001-send-email.sh strips mail headers from a message file, not a
commit object.
* t1450-fsck.sh strips the header off a hand-built commit object while
constructing a malformed one for fsck to reject.
* t4014-format-patch.sh runs the same sed address on a ".patch" file,
with an additional expression.
All converted files pass in full, and a deliberately failing
"git cat-file" now fails a converted test that previously passed.
Signed-off-by: Shlok Kulshreshtha <diy2903@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.diff_initial..side')
0 files changed, 0 insertions, 0 deletions
