@@ -1189,4 +1189,71 @@ test_expect_failure 'check conflicting entry types (submodule vs symlink)' '
1189
1189
)
1190
1190
'
1191
1191
1192
+ #
1193
+ # criss-cross with regular files that have conflicting modes:
1194
+ #
1195
+ # B D
1196
+ # o---o
1197
+ # / \ / \
1198
+ # A o X ? F
1199
+ # \ / \ /
1200
+ # o---o
1201
+ # C E
1202
+ #
1203
+ # Commit A: nothing of note
1204
+ # Commit B: introduce file source_me.bash, not executable
1205
+ # Commit C: introduce file source_me.bash, executable
1206
+ # Commit D: merge B&C, resolving in favor of B
1207
+ # Commit E: merge B&C, resolving in favor of C
1208
+ #
1209
+ # This is an obvious add/add mode conflict. Can git detect it?
1210
+
1211
+ test_expect_success ' setup conflicting modes for regular file' '
1212
+ test_create_repo regular-file-mode-conflict &&
1213
+ (
1214
+ cd regular-file-mode-conflict &&
1215
+
1216
+ touch irrelevant-file &&
1217
+ git add irrelevant-file &&
1218
+ git commit -m A &&
1219
+ git tag A &&
1220
+
1221
+ git checkout -b B A &&
1222
+ echo "command_to_run" >source_me.bash &&
1223
+ git add source_me.bash &&
1224
+ git commit -m B &&
1225
+
1226
+ git checkout -b C A &&
1227
+ echo "command_to_run" >source_me.bash &&
1228
+ git add source_me.bash &&
1229
+ test_chmod +x source_me.bash &&
1230
+ git commit -m C &&
1231
+
1232
+ git checkout -q B^0 &&
1233
+ git merge -s ours -m D C^0 &&
1234
+ git tag D &&
1235
+
1236
+ git checkout -q C^0 &&
1237
+ git merge -s ours -m E B^0 &&
1238
+ git tag E
1239
+ )
1240
+ '
1241
+
1242
+ test_expect_failure ' check conflicting modes for regular file' '
1243
+ (
1244
+ cd regular-file-mode-conflict &&
1245
+
1246
+ git checkout D^0 &&
1247
+
1248
+ test_must_fail git merge -s recursive E^0 &&
1249
+
1250
+ git ls-files -s >out &&
1251
+ test_line_count = 3 out &&
1252
+ git ls-files -u >out &&
1253
+ test_line_count = 2 out &&
1254
+ git ls-files -o >out &&
1255
+ test_line_count = 1 out
1256
+ )
1257
+ '
1258
+
1192
1259
test_done
0 commit comments