I dropped the patch to `same()` as I realized we only need to fix the oneway_merge function, the others (two, three way merge) are fine as they have the checks already in place. The test added in the last patch got slightly larger as now we also test for newly staged files to be blown away in the submodule. v1: The fix is in the last patch, the first patches are just massaging the code base to make the fix easy. The second patch fixes a bug in the test, which was ineffective at testing. The third patch shows the problem this series addresses, the fourth patch is a little refactoring, which I want to keep separate as I would expect it to be a performance regression[1]. The first patch is unrelated, but improves the readability of submodule test cases, which we'd want to improve further. Thanks, Stefan Stefan Beller (5): t/helper/test-lazy-name-hash: fix compilation t/lib-submodule-update.sh: clarify test t/lib-submodule-update.sh: Fix test ignoring ignored files in submodules unpack-trees: oneway_merge to update submodules submodule: submodule_move_head omits old argument in forced case submodule.c | 4 +++- t/helper/test-lazy-init-name-hash.c | 2 +- t/lib-submodule-update.sh | 19 +++++++++++++++++-- unpack-trees.c | 3 +++ 4 files changed, 24 insertions(+), 4 deletions(-) -- 2.15.1.620.gb9897f4670-goog