Skip to content

cat-file: add a --stdin-cmd mode

John Cai via GitGitGadget git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2strvec.c: add a strvec_split_delim()strvec.c strvec.h+31 -00 replies
2/2cat-file: add a --stdin-cmd modebuiltin/cat-file.c t/t1006-cat-file.sh+199 -10 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by.

PatchÆvar Arnfjörð Bjarmason
1/2Helped-by
2/2Helped-by

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] cat-file: add a --stdin-cmd mode

This WIP patch is mostly stealing code from builtin/update-ref.c and implementing the same sort of prefixed command-mode that it supports. I.e. in addition to --batch now supporting:

<object> LF

It'll support with --stdin-cmd, with and without -z, respectively:

object <object> NL
object <object> NUL

The plus being that we can now implement additional commands:

fflush NL
fflush NUL

That command simply calls fflush(stdout), which could be done as an emergent effect before by feeding the input a "NL".

I think this will be useful for other things, e.g. a not-trivial part of "cat-file --batch" time is spent on parsing its argument and seeing if it's a revision, ref etc.

So we could e.g. add a command that only accepts a full-length 40 character SHA-1, or switch the --format output mid-request etc.

1. https://lore.kernel.org/git/[email protected]/

requires ee4d43041d ab/cat-file

John Cai (2):
strvec.c: add a strvec_split_delim()
cat-file: add a --stdin-cmd mode

 builtin/cat-file.c  | 128 +++++++++++++++++++++++++++++++++++++++++++-
 strvec.c            |  23 ++++++++
 strvec.h            |   8 +++
 t/t1006-cat-file.sh |  72 +++++++++++++++++++++++++
 4 files changed, 230 insertions(+), 1 deletion(-)

base-commit: 00780c9af44409a68481c82f63a97bd18bb2593e
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1191%2Fjohn-cai%2Fjc-cat-file-stdin-cmd-mode-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1191/john-cai/jc-cat-file-stdin-cmd-mode-v1
Pull-Request: https://github.com/git/git/pull/1191

Signature · 1 line
gitgitgadget