unpack-trees: oneway_merge to update submodules

When there is a one way merge, each submodule needs to be one way merged as well, if we're asked to recurse into submodules. In case of a submodule, check if it is up-to-date, otherwise set the flag CE_UPDATE, which will trigger an update of it in the phase updating the tree later. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed Jan 5, 2018 at 12:03 UTC ad17312e1170715a15651b3185dae9ebc6b6b8ef
1 file changed +3
unpack-trees.c
+3
@@ -2139,6 +2139,9 @@ int oneway_merge(const struct cache_entry * const *src,
2139 ie_match_stat(o->src_index, old, &st, CE_MATCH_IGNORE_VALID|CE_MATCH_IGNORE_SKIP_WORKTREE))
2140 update |= CE_UPDATE;
2141 }
2142 + if (o->update && S_ISGITLINK(old->ce_mode) &&
2143 + should_update_submodules() && !verify_uptodate(old, o))
2144 + update |= CE_UPDATE;
2145 add_entry(o, old, update, 0);
2146 return 0;
2147 }