> On 03 Aug 2017, at 10:18, Christian Couder <christian.couder@xxxxxxxxx> wrote: > > To properly test passing objects from Git to an external odb > we need an odb-helper script that supports a 'put' > capability/instruction. > > For now we will support only sending raw blobs, so the > supported capability/instruction will be 'put_raw_obj'. What other kind of blobs do you imagine could we send? > While at it let's add a test to check that our odb-helper > script works well. > > Signed-off-by: Christian Couder <chriscool@xxxxxxxxxxxxx> > --- > t/t0400-external-odb.sh | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/t/t0400-external-odb.sh b/t/t0400-external-odb.sh > index ed89f3ab40..3fa0449883 100755 > --- a/t/t0400-external-odb.sh > +++ b/t/t0400-external-odb.sh > @@ -7,10 +7,15 @@ test_description='basic tests for external object databases' > ALT_SOURCE="$PWD/alt-repo/.git" > export ALT_SOURCE > write_script odb-helper <<\EOF > +die() { > + printf >&2 "%s\n" "$@" > + exit 1 > +} > GIT_DIR=$ALT_SOURCE; export GIT_DIR > case "$1" in > init) > echo "capability=get_git_obj" > + echo "capability=put_raw_obj" > echo "capability=have" > ;; > have) > @@ -20,6 +25,16 @@ have) > get_git_obj) > cat "$GIT_DIR"/objects/$(echo $2 | sed 's#..#&/#') > ;; > +put_raw_obj) > + sha1="$2" > + size="$3" > + kind="$4" > + writen=$(git hash-object -w -t "$kind" --stdin) > + test "$writen" = "$sha1" || die "bad sha1 passed '$sha1' vs writen '$writen'" Typo? Should it be "written"? - Lars