Imported Upstream version 2.16.0
[platform/upstream/git.git] / unpack-trees.c
index 26028b7..bf8b602 100644 (file)
@@ -14,6 +14,7 @@
 #include "dir.h"
 #include "submodule.h"
 #include "submodule-config.h"
+#include "fsmonitor.h"
 
 /*
  * Error messages expected by scripts out of plumbing commands such as
@@ -408,6 +409,7 @@ static int apply_sparse_checkout(struct index_state *istate,
                ce->ce_flags &= ~CE_SKIP_WORKTREE;
        if (was_skip_worktree != ce_skip_worktree(ce)) {
                ce->ce_flags |= CE_UPDATE_IN_BASE;
+               mark_fsmonitor_invalid(istate, ce);
                istate->cache_changed |= CE_ENTRY_CHANGED;
        }
 
@@ -1541,15 +1543,15 @@ static int verify_clean_subdirectory(const struct cache_entry *ce,
        int cnt = 0;
 
        if (S_ISGITLINK(ce->ce_mode)) {
-               unsigned char sha1[20];
-               int sub_head = resolve_gitlink_ref(ce->name, "HEAD", sha1);
+               struct object_id oid;
+               int sub_head = resolve_gitlink_ref(ce->name, "HEAD", &oid);
                /*
                 * If we are not going to update the submodule, then
                 * we don't care.
                 */
-               if (!sub_head && !hashcmp(sha1, ce->oid.hash))
+               if (!sub_head && !oidcmp(&oid, &ce->oid))
                        return 0;
-               return verify_clean_submodule(sub_head ? NULL : sha1_to_hex(sha1),
+               return verify_clean_submodule(sub_head ? NULL : oid_to_hex(&oid),
                                              ce, error_type, o);
        }
 
@@ -1809,8 +1811,7 @@ static int merged_entry(const struct cache_entry *ce,
                invalidate_ce_path(old, o);
        }
 
-       if (do_add_entry(o, merge, update, CE_STAGEMASK) < 0)
-               return -1;
+       do_add_entry(o, merge, update, CE_STAGEMASK);
        return 1;
 }