Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2017-03-15 00:46:38 +0300
committerJunio C Hamano <gitster@pobox.com>2017-03-17 00:07:16 +0300
commitd6b12300676c85175bb05088c79e4b975aed820c (patch)
treea47b5873a0391bac0e540e433afbfbaac7ba1964 /unpack-trees.c
parent6e3c1595c66e2b192a2a516447c5645814766339 (diff)
unpack-trees: pass old oid to verify_clean_submodule
The check (which uses the old oid) is yet to be implemented, but this part is just a refactor, so it can go separately first. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'unpack-trees.c')
-rw-r--r--unpack-trees.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index 3a8ee19fe8..616a0ae4b2 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1407,7 +1407,8 @@ static void invalidate_ce_path(const struct cache_entry *ce,
* Currently, git does not checkout subprojects during a superproject
* checkout, so it is not going to overwrite anything.
*/
-static int verify_clean_submodule(const struct cache_entry *ce,
+static int verify_clean_submodule(const char *old_sha1,
+ const struct cache_entry *ce,
enum unpack_trees_error_types error_type,
struct unpack_trees_options *o)
{
@@ -1427,16 +1428,18 @@ static int verify_clean_subdirectory(const struct cache_entry *ce,
struct dir_struct d;
char *pathbuf;
int cnt = 0;
- unsigned char sha1[20];
- if (S_ISGITLINK(ce->ce_mode) &&
- resolve_gitlink_ref(ce->name, "HEAD", sha1) == 0) {
- /* If we are not going to update the submodule, then
+ if (S_ISGITLINK(ce->ce_mode)) {
+ unsigned char sha1[20];
+ int sub_head = resolve_gitlink_ref(ce->name, "HEAD", sha1);
+ /*
+ * If we are not going to update the submodule, then
* we don't care.
*/
- if (!hashcmp(sha1, ce->oid.hash))
+ if (!sub_head && !hashcmp(sha1, ce->oid.hash))
return 0;
- return verify_clean_submodule(ce, error_type, o);
+ return verify_clean_submodule(sub_head ? NULL : sha1_to_hex(sha1),
+ ce, error_type, o);
}
/*