Re: [PATCH v10 4/4] cat-file: add --batch-command mode
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Feb 19, 2022, 06:35 UTC
- Message-ID
- <220219.865ypbe51h.gmgdl@evledraar.gmail.com>
- In-Reply-To
- <c6ea1214062381e2c669959e9084adead5600510.1645208594.git.gitgitgadget@gmail.com>
On Fri, Feb 18 2022, John Cai via GitGitGadget wrote:
Show 35 quoted lines
> From: John Cai <johncai86@gmail.com> > [....] > + for opt in --buffer --no-buffer > + do > + test -z "$content" || > + test_expect_success "--batch-command $opt output of $type content is correct" ' > + maybe_remove_timestamp "$batch_output" $no_ts >expect && > + maybe_remove_timestamp "$(test_write_lines "contents $sha1" | > + git cat-file --batch-command $opt)" $no_ts >actual && > + test_cmp expect actual > + ' > + > [...] > +test_expect_success '--batch-command with multiple command calls gives correct format' ' > + remove_timestamp >expect <<-EOF && > + $hello_sha1 blob $hello_size > + $hello_content > + $commit_sha1 commit $commit_size > + $commit_content > + $tag_sha1 tag $tag_size > + $tag_content > + deadbeef missing > + EOF > + > + git cat-file --batch-command --buffer >actual_raw <<-EOF && > + contents $hello_sha1 > + contents $commit_sha1 > + contents $tag_sha1 > + contents deadbeef > + flush > + EOF > + > + remove_timestamp <actual_raw >actual && > + test_cmp expect actual > +'
Re my comment on 3/4; I then tried my suggested change to maybe_remove_timestamp on this patch, and it also works on this commit...