]>
Commit | Line | Data |
---|---|---|
bb034f83 JH |
1 | #!/bin/sh |
2 | ||
3 | test_description='git am running from a subdirectory' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
7 | test_expect_success setup ' | |
8 | echo hello >world && | |
9 | git add world && | |
10 | test_tick && | |
11 | git commit -m initial && | |
12 | git tag initial && | |
13 | echo goodbye >world && | |
14 | git add world && | |
15 | test_tick && | |
16 | git commit -m second && | |
17 | git format-patch --stdout HEAD^ >patchfile && | |
18 | : >expect | |
19 | ' | |
20 | ||
21 | test_expect_success 'am regularly from stdin' ' | |
22 | git checkout initial && | |
23 | git am <patchfile && | |
24 | git diff master >actual && | |
82ebb0b6 | 25 | test_cmp expect actual |
bb034f83 JH |
26 | ' |
27 | ||
28 | test_expect_success 'am regularly from file' ' | |
29 | git checkout initial && | |
30 | git am patchfile && | |
31 | git diff master >actual && | |
82ebb0b6 | 32 | test_cmp expect actual |
bb034f83 JH |
33 | ' |
34 | ||
35 | test_expect_success 'am regularly from stdin in subdirectory' ' | |
36 | rm -fr subdir && | |
37 | git checkout initial && | |
38 | ( | |
39 | mkdir -p subdir && | |
40 | cd subdir && | |
41 | git am <../patchfile | |
42 | ) && | |
43 | git diff master>actual && | |
82ebb0b6 | 44 | test_cmp expect actual |
bb034f83 JH |
45 | ' |
46 | ||
47 | test_expect_success 'am regularly from file in subdirectory' ' | |
48 | rm -fr subdir && | |
49 | git checkout initial && | |
50 | ( | |
51 | mkdir -p subdir && | |
52 | cd subdir && | |
53 | git am ../patchfile | |
54 | ) && | |
55 | git diff master >actual && | |
82ebb0b6 | 56 | test_cmp expect actual |
bb034f83 JH |
57 | ' |
58 | ||
59 | test_expect_success 'am regularly from file in subdirectory with full path' ' | |
60 | rm -fr subdir && | |
61 | git checkout initial && | |
62 | P=$(pwd) && | |
63 | ( | |
64 | mkdir -p subdir && | |
65 | cd subdir && | |
66 | git am "$P/patchfile" | |
67 | ) && | |
68 | git diff master >actual && | |
82ebb0b6 | 69 | test_cmp expect actual |
bb034f83 JH |
70 | ' |
71 | ||
72 | test_done |