summaryrefslogtreecommitdiff
path: root/t/t5552-http-fetch-branch.sh
blob: 0e905d90b7c89bd1225ea3e70844b75b9e311b44 (plain)
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
#!/bin/sh

test_description='fetch just one branch'

. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-httpd.sh
start_httpd

test_expect_success 'setup repo' '
	git init "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
	(
		cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
		test_commit 1
	)
'

test_expect_success 'clone http repository' '
	git clone $HTTPD_URL/smart/repo.git clone
'

test_expect_success 'make some more commits' '
	(
		cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
		test_commit 2 &&
		git checkout -b another_branch &&
		test_commit 3
		git checkout -b a_third_branch &&
		test_commit 4
	)
'

test_expect_success 'fetch with refspec only fetches requested branch' '
	test_when_finished "rm trace" &&
	(
		cd clone &&
		GIT_TRACE_PACKET="$TRASH_DIRECTORY/trace" git fetch origin another_branch &&
		! grep "refs/heads/master" ../trace
	)
'

stop_httpd
test_done