else
argv_array_push(&cp.args, "-m");
- argv_array_push(&cp.args, old ? old : EMPTY_TREE_SHA1_HEX);
+ if (!(flags & SUBMODULE_MOVE_HEAD_FORCE))
+ argv_array_push(&cp.args, old ? old : EMPTY_TREE_SHA1_HEX);
+
argv_array_push(&cp.args, new ? new : EMPTY_TREE_SHA1_HEX);
if (run_command(&cp)) {
test_submodule_content sub1 origin/modify_sub1
)
'
+
+ test_expect_success "$command: changed submodule worktree is reset" '
+ prolog &&
+ reset_work_tree_to_interested add_sub1 &&
+ (
+ cd submodule_update &&
+ rm sub1/file1 &&
+ : >sub1/new_file &&
+ git -C sub1 add new_file &&
+ $command HEAD &&
+ test_path_is_file sub1/file1 &&
+ test_path_is_missing sub1/new_file
+ )
+ '
}