aboutsummaryrefslogtreecommitdiffstats
path: root/commit.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2023-06-06 07:19:41 +0200
committerJunio C Hamano <gitster@pobox.com>2023-06-12 13:23:24 -0700
commit3217f52a499d5264d98065374a62deb15717b727 (patch)
treeaa8bef5e96dde90e7b48ab244a7fde9d2ee34080 /commit.c
parentstrbuf: provide CRLF-aware helper to read until a specified delimiter (diff)
downloadgit-3217f52a499d5264d98065374a62deb15717b727.tar.gz
git-3217f52a499d5264d98065374a62deb15717b727.zip
cat-file: simplify reading from standard input
The batch modes of git-cat-file(1) read queries from stantard input that are either newline- or NUL-delimited. This code was introduced via db9d67f2e9 (builtin/cat-file.c: support NUL-delimited input with `-z`, 2022-07-22), which notes that: """ The refactoring here is slightly unfortunate, since we turn loops like: while (strbuf_getline(&buf, stdin) != EOF) into: while (1) { int ret; if (opt->nul_terminated) ret = strbuf_getline_nul(&input, stdin); else ret = strbuf_getline(&input, stdin); if (ret == EOF) break; } """ The commit proposed introducing a helper function that is easier to use, which is just what we have done in the preceding commit. Refactor the code to use this new helper to simplify the loop. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
0 files changed, 0 insertions, 0 deletions