]> git.ipfire.org Git - thirdparty/git.git/commit
strbuf: accept a comment string for strbuf_stripspace()
authorJeff King <peff@peff.net>
Tue, 12 Mar 2024 09:17:27 +0000 (05:17 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 12 Mar 2024 20:28:10 +0000 (13:28 -0700)
commit2982b65690d7a043275558c74202a89b0450cbf5
tree06ec4677fd4df56aebbf839f54e805c68bd8cc1a
parent72a7d5d97fe0338719a45787994b04a4170719da
strbuf: accept a comment string for strbuf_stripspace()

As part of our transition to multi-byte comment characters, let's take a
NUL-terminated string pointer for strbuf_stripspace(), rather than a
single character. We can continue to support its feature of ignoring
comments by accepting a NULL pointer (as opposed to the current behavior
of a NUL byte).

All of the callers have to be adjusted, but they can all just pass
comment_line_str (or NULL).

Inside the function we detect comments by comparing the first byte of a
line to the comment character. We'll adjust that to use starts_with(),
which will match multiple bytes (though for now, of course, we still
only allow a single byte, so it's academic).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 files changed:
builtin/am.c
builtin/branch.c
builtin/commit.c
builtin/notes.c
builtin/rebase.c
builtin/stripspace.c
builtin/tag.c
builtin/worktree.c
gpg-interface.c
rebase-interactive.c
sequencer.c
strbuf.c
strbuf.h