diff options
author | Stefan Beller <sbeller@google.com> | 2018-01-05 12:03:04 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-01-05 12:35:35 -0800 |
commit | 7dcc1f4df8c74ec43d9b3e8c97aa985c2663b467 (patch) | |
tree | 34cf3bc69af82512426e5b7322d2ed6d87d33f18 /t | |
parent | unpack-trees: oneway_merge to update submodules (diff) | |
download | tgif-7dcc1f4df8c74ec43d9b3e8c97aa985c2663b467.tar.xz |
submodule: submodule_move_head omits old argument in forced case
When using hard reset or forced checkout with the option to recurse into
submodules, the submodules need to be reset, too.
It turns out that we need to omit the duplicate old argument to read-tree
in all forced cases to omit the 2 way merge and use the more assertive
behavior of reading the specific new tree into the index and updating
the working tree.
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/lib-submodule-update.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh index fb0173ea87..1f38a85371 100755 --- a/t/lib-submodule-update.sh +++ b/t/lib-submodule-update.sh @@ -1015,4 +1015,18 @@ test_submodule_forced_switch_recursing_with_args () { 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 + ) + ' } |