]> git.ipfire.org Git - thirdparty/git.git/commit
trace2: trim_trailing_newline followed by trim is a no-op
authorJunio C Hamano <gitster@pobox.com>
Thu, 31 Jul 2025 22:54:32 +0000 (15:54 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 3 Aug 2025 05:44:58 +0000 (22:44 -0700)
commitcb8e82a6414653d5dbda81eedb8ca0cd9ce34c68
treebe38bc928f0924107a0ddb6f093f49b6b388335e
parentd6fd08bd760711d51b98f9ad98c3cd94d90d2618
trace2: trim_trailing_newline followed by trim is a no-op

strbuf_trim_trailing_newline() removes a LF or a CRLF from the tail
of a string.  If the code plans to call strbuf_trim() immediately
after doing so, the code is better off skipping the EOL trimming in
the first place.  After all, LF/CRLF at the end is a mere special
case of whitespaces at the end of the string, which will be removed
by strbuf_rtrim() anyway.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
trace2/tr2_cfg.c