3 test_description
='tg update --continue works after merge resolution'
13 test_expect_success
'setup' '
14 test_create_repo conflict &&
16 git checkout --orphan fractious &&
17 git read-tree --empty &&
19 test_commit "fractious~1" &&
20 tg_test_create_branches <<-EOT &&
21 t/patch1a [PATCH] patch 1 a
24 t/patch1b [PATCH] patch 1 b
27 t/mergeab [STAGE] merge patch 1 a & 1 b
31 topbases="$(tg --top-bases)" &&
32 topbases="${topbases#refs/heads/}" &&
34 test_when_finished topbases="$topbases" &&
35 mergeab_base="$(tg base t/mergeab)" &&
36 test_when_finished mergeab_base="$mergeab_base" &&
37 git checkout -f t/patch1a &&
38 test_commit "alpha" conflict &&
39 git checkout -f t/patch1b &&
40 test_commit "beta" conflict &&
41 cat <<EOT >expected &&
42 Topic Branch: t/mergeab (1/1 commit)
43 Subject: [STAGE] merge patch 1 a & 1 b
49 t/patch1a (1/1 commit)
50 t/patch1b (2/2 commits)
52 tg info -v t/mergeab >actual &&
53 test_cmp actual expected &&
54 test_when_finished test_set_prereq SETUP
57 test_expect_success SETUP
'tg update creates conflict' '
59 test_must_fail tg update t/mergeab &&
60 mergeab_base="$(tg base t/mergeab)" &&
61 test_when_finished mergeab_base="$mergeab_base" &&
62 cat <<EOT >expected &&
63 HEAD -> $topbases/t/mergeab [$mergeab_base]
64 tg update in progress; currently updating branch ${sq}t/mergeab${sq}
65 You are currently updating as a result of:
67 (use "tg update --continue" to continue)
68 (use "tg update --skip" to skip this branch and continue)
69 (use "tg update --stop" to stop and retain changes so far)
70 (use "tg update --abort" to restore pre-update state)
72 fix conflicts and then "git commit" the result
75 test_cmp actual expected
78 test_expect_success SETUP
,LASTOK
'tg status changes with no conflicts' -<<\EOS
80 echo alphabeta
>conflict
&&
82 cat <<EOT >expected &&
83 HEAD -> $topbases/t/mergeab [$mergeab_base]
84 tg update in progress; currently updating branch 't/mergeab'
85 You are currently updating as a result of:
87 (use "tg update --continue" to continue)
88 (use "tg update --skip" to skip this branch and continue)
89 (use "tg update --stop" to stop and retain changes so far)
90 (use "tg update --abort" to restore pre-update state)
92 all conflicts fixed; run "git commit" to record result
95 test_cmp actual expected
98 test_expect_success SETUP
,LASTOK
'tg status changes with git merge done' -<<\EOS
100 git commit
-m 'no conflict' &&
101 mergeab_base
="$(tg base t/mergeab)" &&
102 test_when_finished mergeab_base
="$mergeab_base" &&
103 cat <<EOT >expected &&
104 HEAD -> $topbases/t/mergeab [$mergeab_base]
105 tg update in progress; currently updating branch 't/mergeab'
106 You are currently updating as a result of:
108 (use "tg update --continue" to continue)
109 (use "tg update --skip" to skip this branch and continue)
110 (use "tg update --stop" to stop and retain changes so far)
111 (use "tg update --abort" to restore pre-update state)
112 working directory is clean; non-ignored, untracked files present
115 test_cmp actual expected
118 test_expect_success SETUP
,LASTOK
'tg update --continue succeeds' -<<\EOS
120 cat <<EOT >expected &&
121 tg: The base is up-to-date.
122 tg: Updating t/mergeab against new base...
123 Merge made by the 'trivial aggressive' strategy.
124 1 file changed, 1 insertion(+)
126 tg update
--continue >actual
&&
127 test_cmp actual expected
&&
128 patch1b
="$(git rev-parse --verify --short t/patch1b)" &&
129 final
="$(git rev-parse --verify --short t/mergeab)" &&
130 cat <<EOT >expected &&
131 HEAD -> t/patch1b [$patch1b]
132 working directory is clean; non-ignored, untracked files present
135 test_cmp actual expected
&&
136 cat <<EOT >expected &&
137 HEAD -> t/mergeab [$final]
138 working directory is clean; non-ignored, untracked files present
140 git checkout
-f t
/mergeab
&&
142 test_cmp actual expected