File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -165,14 +165,14 @@ pick_one_preserving_merges () {
165165 die " Cannot write current commit's replacement sha1"
166166 fi
167167
168+ echo $sha1 > " $DOTEST " /current-commit
169+
168170 # rewrite parents; if none were rewritten, we can fast-forward.
169- preserve=t
170171 new_parents=
171172 for p in $( git rev-list --parents -1 $sha1 | cut -d' ' -f2-)
172173 do
173174 if test -f " $REWRITTEN " /$p
174175 then
175- preserve=f
176176 new_p=$( cat " $REWRITTEN " /$p )
177177 test $p ! = $new_p && fast_forward=f
178178 case " $new_parents " in
@@ -189,7 +189,6 @@ pick_one_preserving_merges () {
189189 case $fast_forward in
190190 t)
191191 output warn " Fast forward to $sha1 "
192- test $preserve = f || echo $sha1 > " $REWRITTEN " /$sha1
193192 output git reset --hard $sha1 ||
194193 die " Cannot fast forward to $sha1 "
195194 ;;
@@ -201,7 +200,6 @@ pick_one_preserving_merges () {
201200 output git checkout $first_parent 2> /dev/null ||
202201 die " Cannot move HEAD to $first_parent "
203202
204- echo $sha1 > " $DOTEST " /current-commit
205203 case " $new_parents " in
206204 ' ' * ' ' * )
207205 # redo merge
Original file line number Diff line number Diff line change @@ -250,6 +250,18 @@ test_expect_success 'preserve merges with -p' '
250250 test $(git show HEAD:unrelated-file) = 1
251251'
252252
253+ test_expect_success ' edit ancestor with -p' '
254+ FAKE_LINES="1 edit 2 3 4" git rebase -i -p HEAD~3 &&
255+ echo 2 > unrelated-file &&
256+ test_tick &&
257+ git commit -m L2-modified --amend unrelated-file &&
258+ git rebase --continue &&
259+ git update-index --refresh &&
260+ git diff-files --quiet &&
261+ git diff-index --quiet --cached HEAD -- &&
262+ test $(git show HEAD:unrelated-file) = 2
263+ '
264+
253265test_expect_success ' --continue tries to commit' '
254266 test_tick &&
255267 test_must_fail git rebase -i --onto new-branch1 HEAD^ &&
You can’t perform that action at this time.
0 commit comments