diff-files: careful when inspecting work tree items
[git/spearce.git] / t / t4150-am-subdir.sh
blob52069b469bdeefed921fbc574d12e9d2490f0e8c
1 #!/bin/sh
3 test_description='git am running from a subdirectory'
5 . ./test-lib.sh
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
21 test_expect_success 'am regularly from stdin' '
22 git checkout initial &&
23 git am <patchfile &&
24 git diff master >actual &&
25 test_cmp expect actual
28 test_expect_success 'am regularly from file' '
29 git checkout initial &&
30 git am patchfile &&
31 git diff master >actual &&
32 test_cmp expect actual
35 test_expect_success 'am regularly from stdin in subdirectory' '
36 rm -fr subdir &&
37 git checkout initial &&
39 mkdir -p subdir &&
40 cd subdir &&
41 git am <../patchfile
42 ) &&
43 git diff master>actual &&
44 test_cmp expect actual
47 test_expect_success 'am regularly from file in subdirectory' '
48 rm -fr subdir &&
49 git checkout initial &&
51 mkdir -p subdir &&
52 cd subdir &&
53 git am ../patchfile
54 ) &&
55 git diff master >actual &&
56 test_cmp expect actual
59 test_expect_success 'am regularly from file in subdirectory with full path' '
60 rm -fr subdir &&
61 git checkout initial &&
62 P=$(pwd) &&
64 mkdir -p subdir &&
65 cd subdir &&
66 git am "$P/patchfile"
67 ) &&
68 git diff master >actual &&
69 test_cmp expect actual
72 test_done