mbox series

[0/2] cat-file: force flush of stdout on empty string

Message ID pull.1124.git.git.1636149400.gitgitgadget@gmail.com (mailing list archive)
Headers show
Series cat-file: force flush of stdout on empty string | expand

Message

Christoph Sommer via GitGitGadget Nov. 5, 2021, 9:56 p.m. UTC
When in --buffer mode, it is very useful for the caller to have control over
when the buffer is flushed. Currently there is no convenient way to signal
for the buffer to be flushed. One workaround is to provide any nonexisting
commit to git-cat-file's stdin, in which case the buffer will be flushed and
a "$FOO missing" message will be displayed. However, this is not an ideal
workaround.

Instead, this commit teaches git-cat-file to look for an empty string in
stdin, which will trigger a flush of stdout.

John Cai (2):
  cat-file: force flush of stdout on empty string
  docs: update behavior of git-cat-file --buffer

 Documentation/git-cat-file.txt |  3 ++-
 builtin/cat-file.c             | 11 ++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)


base-commit: 6d82a21a3b699caf378cb0f89b6b0e803fc58480
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1124%2Fjohn-cai%2Fjc%2Fflush-buffer-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1124/john-cai/jc/flush-buffer-v1
Pull-Request: https://github.com/git/git/pull/1124