Remove the assert in CommitData.parse() function
[stgit] / t / t2800-goto-subdir.sh
CommitLineData
ab96cd1c
KH
1#!/bin/sh
2
3test_description='Run "stg goto" in a subdirectory'
4
5. ./test-lib.sh
6
7test_expect_success 'Initialize StGit stack' '
8 stg init &&
9 echo expected1.txt >> .git/info/exclude &&
10 echo expected2.txt >> .git/info/exclude &&
11 echo actual.txt >> .git/info/exclude &&
12 mkdir foo &&
13 for i in 1 2 3; do
14 echo foo$i >> foo/bar &&
15 stg new p$i -m p$i &&
c7506039 16 stg add foo/bar &&
ab96cd1c
KH
17 stg refresh
18 done
19'
20
21cat > expected1.txt <<EOF
22foo1
23EOF
24cat > expected2.txt <<EOF
25bar
26EOF
8d96d568 27test_expect_success 'Goto in subdirectory (just pop)' '
ee11a289 28 (cd foo && stg goto --keep p1) &&
ab96cd1c 29 cat foo/bar > actual.txt &&
d9b2f20a 30 test_cmp expected1.txt actual.txt &&
ab96cd1c 31 ls foo > actual.txt &&
d9b2f20a 32 test_cmp expected2.txt actual.txt
ab96cd1c
KH
33'
34
35test_expect_success 'Prepare conflicting goto' '
36 stg delete p2
37'
38
533d85c2
KW
39# git gives this result before commit 606475f3 ...
40cat > expected1a.txt <<EOF
ab96cd1c
KH
41foo1
42<<<<<<< current:foo/bar
43=======
44foo2
45foo3
46>>>>>>> patched:foo/bar
47EOF
533d85c2
KW
48
49# ... and this result after commit 606475f3.
50cat > expected1b.txt <<EOF
51foo1
52<<<<<<< current
53=======
54foo2
55foo3
56>>>>>>> patched
57EOF
58
ab96cd1c
KH
59cat > expected2.txt <<EOF
60bar
61EOF
8d96d568 62test_expect_success 'Goto in subdirectory (conflicting push)' '
ee11a289 63 (cd foo && stg goto --keep p3) ;
ab96cd1c
KH
64 [ $? -eq 3 ] &&
65 cat foo/bar > actual.txt &&
533d85c2
KW
66 ( test_cmp expected1a.txt actual.txt \
67 || test_cmp expected1b.txt actual.txt ) &&
ab96cd1c 68 ls foo > actual.txt &&
d9b2f20a 69 test_cmp expected2.txt actual.txt
ab96cd1c
KH
70'
71
72test_done