Skip to content

Commit ef92392

Browse files
committed
Merge branch 'ph/stash-rerere' into maint-1.7.11
* ph/stash-rerere: stash: invoke rerere in case of conflict test: git-stash conflict sets up rerere
2 parents 91feb38 + 743bf6d commit ef92392

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

git-stash.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ apply_stash () {
469469
else
470470
# Merge conflict; keep the exit status from merge-recursive
471471
status=$?
472+
git rerere
472473
if test -n "$INDEX_OPTION"
473474
then
474475
gettextln "Index was not unstashed." >&2

t/t7610-mergetool.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ test_expect_success 'setup' '
5555
git rm file12 &&
5656
git commit -m "branch1 changes" &&
5757
58+
git checkout -b stash1 master &&
59+
echo stash1 change file11 >file11 &&
60+
git add file11 &&
61+
git commit -m "stash1 changes" &&
62+
63+
git checkout -b stash2 master &&
64+
echo stash2 change file11 >file11 &&
65+
git add file11 &&
66+
git commit -m "stash2 changes" &&
67+
5868
git checkout master &&
5969
git submodule update -N &&
6070
echo master updated >file1 &&
@@ -193,7 +203,35 @@ test_expect_success 'mergetool skips resolved paths when rerere is active' '
193203
git reset --hard
194204
'
195205

206+
test_expect_success 'conflicted stash sets up rerere' '
207+
git config rerere.enabled true &&
208+
git checkout stash1 &&
209+
echo "Conflicting stash content" >file11 &&
210+
git stash &&
211+
212+
git checkout --detach stash2 &&
213+
test_must_fail git stash apply &&
214+
215+
test -n "$(git ls-files -u)" &&
216+
conflicts="$(git rerere remaining)" &&
217+
test "$conflicts" = "file11" &&
218+
output="$(git mergetool --no-prompt)" &&
219+
test "$output" != "No files need merging" &&
220+
221+
git commit -am "save the stash resolution" &&
222+
223+
git reset --hard stash2 &&
224+
test_must_fail git stash apply &&
225+
226+
test -n "$(git ls-files -u)" &&
227+
conflicts="$(git rerere remaining)" &&
228+
test -z "$conflicts" &&
229+
output="$(git mergetool --no-prompt)" &&
230+
test "$output" = "No files need merging"
231+
'
232+
196233
test_expect_success 'mergetool takes partial path' '
234+
git reset --hard
197235
git config rerere.enabled false &&
198236
git checkout -b test12 branch1 &&
199237
git submodule update -N &&

0 commit comments

Comments
 (0)