summaryrefslogtreecommitdiff
path: root/entry.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2017-04-18 14:37:22 -0700
committerJunio C Hamano <gitster@pobox.com>2017-04-18 21:18:29 -0700
commitcd279e2e1b4f41f0272d90abb2ba5a06c544b3da (patch)
treef9c71e95ab385d37c392ebc61e04128b5985ea86 /entry.c
parent584f8975d2d9530a34bd0b936ae774f82fe30fed (diff)
downloadgit-cd279e2e1b4f41f0272d90abb2ba5a06c544b3da.tar.gz
entry.c: submodule recursing: respect force flag correctly
In case of a non-forced worktree update, the submodule movement is tested in a dry run first, such that it doesn't matter if the actual update is done via the force flag. However for correctness, we want to give the flag as specified by the user. All callers have been inspected and updated if needed. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'entry.c')
-rw-r--r--entry.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/entry.c b/entry.c
index d2b512da90..d6b263f78e 100644
--- a/entry.c
+++ b/entry.c
@@ -208,7 +208,8 @@ static int write_entry(struct cache_entry *ce,
sub = submodule_from_ce(ce);
if (sub)
return submodule_move_head(ce->name,
- NULL, oid_to_hex(&ce->oid), SUBMODULE_MOVE_HEAD_FORCE);
+ NULL, oid_to_hex(&ce->oid),
+ state->force ? SUBMODULE_MOVE_HEAD_FORCE : 0);
break;
default:
return error("unknown file mode for %s in index", path);
@@ -282,12 +283,11 @@ int checkout_entry(struct cache_entry *ce,
unlink_or_warn(ce->name);
return submodule_move_head(ce->name,
- NULL, oid_to_hex(&ce->oid),
- SUBMODULE_MOVE_HEAD_FORCE);
+ NULL, oid_to_hex(&ce->oid), 0);
} else
return submodule_move_head(ce->name,
"HEAD", oid_to_hex(&ce->oid),
- SUBMODULE_MOVE_HEAD_FORCE);
+ state->force ? SUBMODULE_MOVE_HEAD_FORCE : 0);
}
if (!changed)