Re: [PATCH v10 4/4] cat-file: add --batch-command mode
From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2022-02-19 06:36:50
On Fri, Feb 18 2022, John Cai via GitGitGadget wrote:
From: John Cai <redacted> [....] + 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...