summaryrefslogtreecommitdiff
path: root/t/t4150-am-subdir.sh
blob: 52069b469bdeefed921fbc574d12e9d2490f0e8c (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
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
#!/bin/sh
 
test_description='git am running from a subdirectory'
 
. ./test-lib.sh
 
test_expect_success setup '
	echo hello >world &&
	git add world &&
	test_tick &&
	git commit -m initial &&
	git tag initial &&
	echo goodbye >world &&
	git add world &&
	test_tick &&
	git commit -m second &&
	git format-patch --stdout HEAD^ >patchfile &&
	: >expect
'
 
test_expect_success 'am regularly from stdin' '
	git checkout initial &&
	git am <patchfile &&
	git diff master >actual &&
	test_cmp expect actual
'
 
test_expect_success 'am regularly from file' '
	git checkout initial &&
	git am patchfile &&
	git diff master >actual &&
	test_cmp expect actual
'
 
test_expect_success 'am regularly from stdin in subdirectory' '
	rm -fr subdir &&
	git checkout initial &&
	(
		mkdir -p subdir &&
		cd subdir &&
		git am <../patchfile
	) &&
	git diff master>actual &&
	test_cmp expect actual
'
 
test_expect_success 'am regularly from file in subdirectory' '
	rm -fr subdir &&
	git checkout initial &&
	(
		mkdir -p subdir &&
		cd subdir &&
		git am ../patchfile
	) &&
	git diff master >actual &&
	test_cmp expect actual
'
 
test_expect_success 'am regularly from file in subdirectory with full path' '
	rm -fr subdir &&
	git checkout initial &&
	P=$(pwd) &&
	(
		mkdir -p subdir &&
		cd subdir &&
		git am "$P/patchfile"
	) &&
	git diff master >actual &&
	test_cmp expect actual
'
 
test_done