diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2015-06-20 16:17:28 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-06-20 16:17:28 +0200 |
commit | 624c949f01ca553fdd0b42fbac439e822c1bdd5f (patch) | |
tree | c506e0d65967c0f6e51c7595aa383fe0107e29e8 /src/submodule.c | |
parent | 5e947c91d49aacc8abb5b3f018737c72c52486a9 (diff) | |
download | libgit2-cmn/index-checksum.tar.gz |
index: make relative comparison use the checksum as wellcmn/index-checksum
This is used by the submodule in order to figure out if the index has
changed since it last read it. Using a timestamp is racy, so let's make
it use the checksum, just like we now do for reloading the index itself.
Diffstat (limited to 'src/submodule.c')
-rw-r--r-- | src/submodule.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/submodule.c b/src/submodule.c index 1139df973..246502e99 100644 --- a/src/submodule.c +++ b/src/submodule.c @@ -1946,7 +1946,7 @@ static int submodule_cache_refresh(git_submodule_cache *cache, int refresh) update_index = update_head = update_gitmod = true; else { update_index = - !idx || git_index__changed_relative_to(idx, &cache->index_stamp); + !idx || git_index__changed_relative_to(idx, &cache->index_checksum); update_head = !head || !git_oid_equal(&cache->head_id, git_tree_id(head)); @@ -1984,8 +1984,7 @@ static int submodule_cache_refresh(git_submodule_cache *cache, int refresh) if ((error = submodule_cache_refresh_from_index(cache, idx)) < 0) goto cleanup; - git_futils_filestamp_set( - &cache->index_stamp, git_index__filestamp(idx)); + git_oid_cpy(&cache->index_checksum, git_index_checksum(idx)); } /* add submodule information from HEAD */ |