Eric Ju <eric.peijian@xxxxxxxxx> writes: [snip] > diff --git a/t/t1017-cat-file-remote-object-info.sh b/t/t1017-cat-file-remote-object-info.sh > new file mode 100755 > index 0000000000..64eb55bd9e > --- /dev/null > +++ b/t/t1017-cat-file-remote-object-info.sh > @@ -0,0 +1,748 @@ > +#!/bin/sh > + > +test_description='git cat-file --batch-command with remote-object-info command' > + > +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main > +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME > + > +. ./test-lib.sh > + > +echo_without_newline () { > + printf '%s' "$*" > +} > + > +echo_without_newline_nul () { > + echo_without_newline "$@" | tr '\n' '\0' > +} > + > +strlen () { > + echo_without_newline "$1" | wc -c | sed -e 's/^ *//' > +} > + > +hello_content="Hello World" > +hello_size=$(strlen "$hello_content") > +hello_oid=$(echo_without_newline "$hello_content" | git hash-object --stdin) > + > +# This is how we get 13: > +# 13 = <file mode> + <a_space> + <file name> + <a_null>, where > +# file mode is 100644, which is 6 characters; > +# file name is hello, which is 5 characters > +# a space is 1 character and a null is 1 character > +tree_size=$(($(test_oid rawsz) + 13)) > + > +commit_message="Initial commit" > + > +# This is how we get 137: > +# 137 = <tree header> + <a_space> + <a newline> + > +# <Author line> + <a newline> + > +# <Committer line> + <a newline> + > +# <a newline> + > +# <commit message length> > +# An easier way to calculate is: 1. use `git cat-file commit <commit hash> | wc -c`, > +# to get 177, 2. then deduct 40 hex characters to get 137 > +commit_size=$(($(test_oid hexsz) + 137)) > + > +tag_header_without_oid="type blob > +tag hellotag > +tagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" > +tag_header_without_timestamp="object $hello_oid > +$tag_header_without_oid" > +tag_description="This is a tag" > +tag_content="$tag_header_without_timestamp 0 +0000 > + > +$tag_description" > + > +tag_oid=$(echo_without_newline "$tag_content" | git hash-object -t tag --stdin -w) > +tag_size=$(strlen "$tag_content") > + > +set_transport_variables () { > + hello_sha1=$(echo_without_newline "$hello_content" | git hash-object --stdin) > + tree_sha1=$(git -C "$1" write-tree) > + commit_sha1=$(echo_without_newline "$commit_message" | git -C "$1" commit-tree $tree_sha1) > + tag_sha1=$(echo_without_newline "$tag_content" | git -C "$1" hash-object -t tag --stdin -w) I see here and various other places in this file names with "_sha1". I think it makes more sense to name them "_oid" because these works also fine with GIT_TEST_DEFAULT_HASH=sha256. Other than that I don't have any comments about this patch series. -- Toon