Thread (55 messages) flat view 55 messages, 5 authors, 2017-09-14

Re: [PATCH v5 12/40] t0400: add 'put_raw_obj' instruction to odb-helper script

From: Lars Schneider <hidden>
Date: 2017-09-10 12:13:02

On 03 Aug 2017, at 10:18, Christian Couder [off-list ref] 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?

quoted hunk ↗ jump to hunk
While at it let's add a test to check that our odb-helper
script works well.

Signed-off-by: Christian Couder <redacted>
---
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help