3 test_description
='Run "stg goto" in a subdirectory'
7 test_expect_success
'Initialize StGit stack' '
9 echo expected1.txt >> .git/info/exclude &&
10 echo expected2.txt >> .git/info/exclude &&
11 echo actual.txt >> .git/info/exclude &&
14 echo foo$i >> foo/bar &&
21 cat > expected1.txt
<<EOF
24 cat > expected2.txt
<<EOF
27 test_expect_success
'Goto in subdirectory (just pop)' '
28 (cd foo && stg goto --keep p1) &&
29 cat foo/bar > actual.txt &&
30 test_cmp expected1.txt actual.txt &&
31 ls foo > actual.txt &&
32 test_cmp expected2.txt actual.txt
35 test_expect_success
'Prepare conflicting goto' '
39 # git gives this result before commit 606475f3 ...
40 cat > expected1a.txt
<<EOF
42 <<<<<<< current:foo/bar
46 >>>>>>> patched:foo/bar
49 # ... and this result after commit 606475f3.
50 cat > expected1b.txt
<<EOF
59 cat > expected2.txt
<<EOF
62 test_expect_success
'Goto in subdirectory (conflicting push)' '
63 (cd foo && stg goto --keep p3) ;
65 cat foo/bar > actual.txt &&
66 ( test_cmp expected1a.txt actual.txt \
67 || test_cmp expected1b.txt actual.txt ) &&
68 ls foo > actual.txt &&
69 test_cmp expected2.txt actual.txt