git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
1b2205e273a5b5b9cca7c6df282f038da14d611c blob 2848 bytes (raw)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
 
#!/bin/sh

test_description='tests for read-object process passing plain objects to an HTTPD server'

. ./test-lib.sh

# If we don't specify a port, the current test number will be used
# which will not work as it is less than 1024, so it can only be used by root.
LIB_HTTPD_PORT=$(expr ${this_test#t} + 12000)

. "$TEST_DIRECTORY"/lib-httpd.sh

start_httpd apache-e-odb.conf

PATH="$PATH:$TEST_DIRECTORY/t0570"

# odb helper script must see this
export HTTPD_URL

HELPER="read-object-plain"

test_expect_success 'setup repo with a root commit' '
	test_commit zero
'

test_expect_success 'setup another repo from the first one' '
	git init other-repo &&
	(cd other-repo &&
	 git remote add origin .. &&
	 git pull origin master &&
	 git checkout master &&
	 git log)
'

test_expect_success 'setup the helper in the root repo' '
	git config odb.magic.subprocessCommand "$HELPER"
'

UPLOADFILENAME="hello_apache_upload.txt"

UPLOAD_URL="$HTTPD_URL/upload/?sha1=$UPLOADFILENAME&size=123&type=blob"

test_expect_success 'can upload a file' '
	echo "Hello Apache World!" >hello_to_send.txt &&
	echo "How are you?" >>hello_to_send.txt &&
	curl --data-binary @hello_to_send.txt --include "$UPLOAD_URL" >out_upload
'

LIST_URL="$HTTPD_URL/list/"

test_expect_success 'can list uploaded files' '
	curl --include "$LIST_URL" >out_list &&
	grep "$UPLOADFILENAME" out_list
'

test_expect_success 'can delete uploaded files' '
	curl --data "delete" --include "$UPLOAD_URL&delete=1" >out_delete &&
	curl --include "$LIST_URL" >out_list2 &&
	! grep "$UPLOADFILENAME" out_list2
'

FILES_DIR="httpd/www/files"

test_expect_success 'new blobs are transfered to the http server' '
	test_commit one &&
	hash1=$(git ls-tree HEAD | grep one.t | cut -f1 | cut -d\  -f3) &&
	echo "$hash1-4-blob" >expected &&
	ls "$FILES_DIR" >actual &&
	test_cmp expected actual
'

test_expect_success 'blobs can be retrieved from the http server' '
	git cat-file blob "$hash1" &&
	git log -p >expected
'

test_expect_success 'update other repo from the first one' '
	(cd other-repo &&
	 git fetch origin "refs/odbs/magic/*:refs/odbs/magic/*" &&
	 test_must_fail git cat-file blob "$hash1" &&
	 git config odb.magic.subprocesscommand "$HELPER" &&
	 git cat-file blob "$hash1" &&
	 git pull origin master)
'

test_expect_success 'local clone from the first repo' '
	mkdir my-clone &&
	(cd my-clone &&
	 git clone .. . &&
	 git cat-file blob "$hash1")
'

test_expect_success 'no-local clone from the first repo fails' '
	mkdir my-other-clone &&
	(cd my-other-clone &&
	 test_must_fail git clone --no-local .. .) &&
	rm -rf my-other-clone
'

test_expect_success 'no-local clone from the first repo with helper succeeds' '
	mkdir my-other-clone &&
	(cd my-other-clone &&
	 git clone -c odb.magic.subprocessCommand="$HELPER" --no-local .. .) &&
	rm -rf my-other-clone
'

stop_httpd

test_done
debug log:

solving 1b2205e273 ...
found 1b2205e273 in https://public-inbox.org/git/20180319133147.15413-33-chriscool@tuxfamily.org/

applying [1/1] https://public-inbox.org/git/20180319133147.15413-33-chriscool@tuxfamily.org/
diff --git a/t/t0570-read-object-http-e-odb.sh b/t/t0570-read-object-http-e-odb.sh
new file mode 100755
index 0000000000..1b2205e273

Checking patch t/t0570-read-object-http-e-odb.sh...
Applied patch t/t0570-read-object-http-e-odb.sh cleanly.

index at:
100755 1b2205e273a5b5b9cca7c6df282f038da14d611c	t/t0570-read-object-http-e-odb.sh

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).