]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/lib-rebase.sh
rebase -r: don't write .git/MERGE_MSG when fast-forwarding
[thirdparty/git.git] / t / lib-rebase.sh
index 99d9e7efd2d4d45a9ca4e65a1ef92ed43ed20e1a..ec6b9b107da4eaab70e221b07c25c9f949f09b14 100644 (file)
@@ -173,10 +173,16 @@ set_reword_editor () {
 
        write_script reword-editor.sh <<-EOF &&
        # Save the oid of the first reworded commit so we can check rebase
-       # fast-forwards to it
+       # fast-forwards to it. Also check that we do not write .git/MERGE_MSG
+       # when fast-forwarding
        if ! test -s reword-oid
        then
-               git rev-parse HEAD >reword-oid
+               git rev-parse HEAD >reword-oid &&
+               if test -f .git/MERGE_MSG
+               then
+                       echo 1>&2 "error: .git/MERGE_MSG exists"
+                       exit 1
+               fi
        fi &&
        # There should be no uncommited changes
        git diff --exit-code HEAD &&