fill_stat_cache_info(): prepare for an fsmonitor fix
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 24 May 2019 12:23:47 +0000 (05:23 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 28 May 2019 19:43:42 +0000 (12:43 -0700)
We will need to pass down the `struct index_state` to
`mark_fsmonitor_valid()` for an upcoming bug fix, and this here function
calls that there function, so we need to extend the signature of
`fill_stat_cache_info()` first.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
apply.c
builtin/update-index.c
cache.h
entry.c
read-cache.c
diff --git a/apply.c b/apply.c
index f15afa9f6af98ae41af60eb2296ee35d38ccc7fd..4992eca416c9c2b5d21de42460cafa839df25f4e 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -4310,7 +4310,7 @@ static int add_index_file(struct apply_state *state,
                                                     "created file '%s'"),
                                                   path);
                        }
                                                     "created file '%s'"),
                                                   path);
                        }
-                       fill_stat_cache_info(ce, &st);
+                       fill_stat_cache_info(state->repo->index, ce, &st);
                }
                if (write_object_file(buf, size, blob_type, &ce->oid) < 0) {
                        discard_cache_entry(ce);
                }
                if (write_object_file(buf, size, blob_type, &ce->oid) < 0) {
                        discard_cache_entry(ce);
index 27db0928bf052b0c518bee57ffa7cdd6c03d5d85..3f8cc6ccb47c2f8927e91076a8844d2cfd8a0bb2 100644 (file)
@@ -280,7 +280,7 @@ static int add_one_path(const struct cache_entry *old, const char *path, int len
        memcpy(ce->name, path, len);
        ce->ce_flags = create_ce_flags(0);
        ce->ce_namelen = len;
        memcpy(ce->name, path, len);
        ce->ce_flags = create_ce_flags(0);
        ce->ce_namelen = len;
-       fill_stat_cache_info(ce, st);
+       fill_stat_cache_info(&the_index, ce, st);
        ce->ce_mode = ce_mode_from_stat(old, st->st_mode);
 
        if (index_path(&the_index, &ce->oid, path, st,
        ce->ce_mode = ce_mode_from_stat(old, st->st_mode);
 
        if (index_path(&the_index, &ce->oid, path, st,
diff --git a/cache.h b/cache.h
index b4bb2e2c11adff0061065fa975874c7c4a2a318b..bf20337ef435234acf171f76137e683e66fb22d2 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -826,7 +826,7 @@ int match_stat_data(const struct stat_data *sd, struct stat *st);
 int match_stat_data_racy(const struct index_state *istate,
                         const struct stat_data *sd, struct stat *st);
 
 int match_stat_data_racy(const struct index_state *istate,
                         const struct stat_data *sd, struct stat *st);
 
-void fill_stat_cache_info(struct cache_entry *ce, struct stat *st);
+void fill_stat_cache_info(struct index_state *istate, struct cache_entry *ce, struct stat *st);
 
 #define REFRESH_REALLY         0x0001  /* ignore_valid */
 #define REFRESH_UNMERGED       0x0002  /* allow unmerged */
 
 #define REFRESH_REALLY         0x0001  /* ignore_valid */
 #define REFRESH_UNMERGED       0x0002  /* allow unmerged */
diff --git a/entry.c b/entry.c
index 0e4f2f29101f913d0db2c401851f279eac496f02..53380bb614c19e82edfb45049f1703b4a3b9c8a3 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -373,7 +373,7 @@ static int write_entry(struct cache_entry *ce,
                        if (lstat(ce->name, &st) < 0)
                                return error_errno("unable to stat just-written file %s",
                                                   ce->name);
                        if (lstat(ce->name, &st) < 0)
                                return error_errno("unable to stat just-written file %s",
                                                   ce->name);
-               fill_stat_cache_info(ce, &st);
+               fill_stat_cache_info(state->istate, ce, &st);
                ce->ce_flags |= CE_UPDATE_IN_BASE;
                mark_fsmonitor_invalid(state->istate, ce);
                state->istate->cache_changed |= CE_ENTRY_CHANGED;
                ce->ce_flags |= CE_UPDATE_IN_BASE;
                mark_fsmonitor_invalid(state->istate, ce);
                state->istate->cache_changed |= CE_ENTRY_CHANGED;
index 22e7b9944e35d257b144fe06dce2073c91d4819f..d3b43ae3bad3c053d0d4ef773b9f880699a4f6a0 100644 (file)
@@ -195,7 +195,7 @@ int match_stat_data(const struct stat_data *sd, struct stat *st)
  * cache, ie the parts that aren't tracked by GIT, and only used
  * to validate the cache.
  */
  * cache, ie the parts that aren't tracked by GIT, and only used
  * to validate the cache.
  */
-void fill_stat_cache_info(struct cache_entry *ce, struct stat *st)
+void fill_stat_cache_info(struct index_state *istate, struct cache_entry *ce, struct stat *st)
 {
        fill_stat_data(&ce->ce_stat_data, st);
 
 {
        fill_stat_data(&ce->ce_stat_data, st);
 
@@ -728,7 +728,7 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st,
        memcpy(ce->name, path, namelen);
        ce->ce_namelen = namelen;
        if (!intent_only)
        memcpy(ce->name, path, namelen);
        ce->ce_namelen = namelen;
        if (!intent_only)
-               fill_stat_cache_info(ce, st);
+               fill_stat_cache_info(istate, ce, st);
        else
                ce->ce_flags |= CE_INTENT_TO_ADD;
 
        else
                ce->ce_flags |= CE_INTENT_TO_ADD;
 
@@ -1447,7 +1447,7 @@ static struct cache_entry *refresh_cache_ent(struct index_state *istate,
        updated = make_empty_cache_entry(istate, ce_namelen(ce));
        copy_cache_entry(updated, ce);
        memcpy(updated->name, ce->name, ce->ce_namelen + 1);
        updated = make_empty_cache_entry(istate, ce_namelen(ce));
        copy_cache_entry(updated, ce);
        memcpy(updated->name, ce->name, ce->ce_namelen + 1);
-       fill_stat_cache_info(updated, &st);
+       fill_stat_cache_info(istate, updated, &st);
        /*
         * If ignore_valid is not set, we should leave CE_VALID bit
         * alone.  Otherwise, paths marked with --no-assume-unchanged
        /*
         * If ignore_valid is not set, we should leave CE_VALID bit
         * alone.  Otherwise, paths marked with --no-assume-unchanged