@@ -37,12 +37,10 @@ def test_reuse_recorded_resolution(
3737 history_with_two_conflicting_commits (auto_update = auto_update )
3838
3939 # Uncached case: Record the user's resolution (in .git/rr-cache/*/preimage).
40- with editor_main (("-i" , "HEAD~~" ), input = b"y\n " * 4 ) as ed :
40+ with editor_main (("-i" , "HEAD~~" ), input = b"y\n " * 2 ) as ed :
4141 flip_last_two_commits (repo , ed )
4242 with ed .next_file () as f :
4343 f .replace_dedent ("spam\n " )
44- with ed .next_file () as f :
45- f .replace_dedent ("eggs spam\n " )
4644
4745 tree_after_resolving_conflicts = repo .get_commit ("HEAD" ).tree ()
4846 bash ("git reset --hard HEAD@{1}" )
@@ -51,18 +49,16 @@ def test_reuse_recorded_resolution(
5149 acceptance_input = None
5250 intermediate_state = "spam"
5351 if not auto_update :
54- acceptance_input = b"y\n " * 2
52+ acceptance_input = b"y\n "
5553 if custom_resolution is not None :
56- acceptance_input = b"n\n " + b"y\n " * 4
54+ acceptance_input = b"n\n " + b"y\n " * 2
5755 intermediate_state = custom_resolution
5856
5957 with editor_main (("-i" , "HEAD~~" ), input = acceptance_input ) as ed :
6058 flip_last_two_commits (repo , ed )
6159 if custom_resolution is not None :
6260 with ed .next_file () as f :
6361 f .replace_dedent (custom_resolution + "\n " )
64- with ed .next_file () as f :
65- f .replace_dedent ("eggs spam\n " )
6662
6763 assert tree_after_resolving_conflicts == repo .get_commit ("HEAD" ).tree ()
6864
@@ -96,12 +92,10 @@ def test_rerere_merge(repo: Repository) -> None:
9692 bash ("git commit -am 'commit 2'" )
9793
9894 # Record a resolution for changing the order of two commits.
99- with editor_main (("-i" , "HEAD~~" ), input = b"y\n y\n y \n y \ n " ) as ed :
95+ with editor_main (("-i" , "HEAD~~" ), input = b"y\n y\n " ) as ed :
10096 flip_last_two_commits (repo , ed )
10197 with ed .next_file () as f :
10298 f .replace_dedent (b"resolved1\n " + 9 * b"x\n " )
103- with ed .next_file () as f :
104- f .replace_dedent (b"resolved2\n " + 9 * b"x\n " )
10599 # Go back to the old history so we can try replaying the resolution.
106100 bash ("git reset --hard HEAD@{1}" )
107101
@@ -124,15 +118,9 @@ def test_rerere_merge(repo: Repository) -> None:
124118 """\
125119 @@ -1 +1 @@
126120 -resolved1
127- +resolved2"""
128- )
129- leftover_index = hunks (repo .git ("diff" , "-U0" , "HEAD" ))
130- assert leftover_index == dedent (
131- """\
132- @@ -1 +1 @@
133- -resolved2
134- +original2"""
121+ +original2"""
135122 )
123+ assert leftover_index (repo .git ("diff" , "-U0" , "HEAD" )) == ""
136124
137125
138126def test_replay_resolution_recorded_by_git (repo : Repository ) -> None :
@@ -154,25 +142,28 @@ def test_replay_resolution_recorded_by_git(repo: Repository) -> None:
154142 """
155143 )
156144
157- # Now let's try to do the same thing with git-revise, reusing the recorded resolution.
145+ # Git-revise may well reuse an intermediate state resolution,
146+ # but actually knows that nobody expects the final state to change
147+ # when just changing the order it's done: Whenever the final state
148+ # is known, that pointless second conflict is bypassed.
158149 with editor_main (("-i" , "HEAD~~" )) as ed :
159150 flip_last_two_commits (repo , ed )
160151
161152 assert repo .git ("log" , "-p" , trim_newline = False ).decode () == dedent (
162153 """\
163- commit 44fdce0cf7ae75ed5edac5f3defed83cddf3ec4a
154+ commit 31aa1057aca9f039e997fff9396fb9656fb4c01c
164155 Author: Bash Author <[email protected] > 165156 Date: Thu Jul 13 21:40:00 2017 -0500
166157
167158 add eggs
168159
169160 diff --git a/file b/file
170- index 5d0f8a8..cb90548 100644
161+ index 5d0f8a8..2481b83 100644
171162 --- a/file
172163 +++ b/file
173164 @@ -1 +1 @@
174165 -intermediate state
175- +something completely different
166+ +eggs spam
176167
177168 commit 1fa5135a6cce1f63dc2f5584ee68e15a4de3a99c
178169 Author: Bash Author <[email protected] >
0 commit comments