summaryrefslogtreecommitdiff
path: root/src/odb_pack.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2011-05-01 21:31:58 +0300
committerVicent Marti <tanoku@gmail.com>2011-05-01 21:31:58 +0300
commitc7b79af3f035b06095ba9d9ad61c3c766764b818 (patch)
treece37a26ff0aaf5e45a9065575994d93682ca30dd /src/odb_pack.c
parent7c37aa3ac5eecd0e725d0207c0507c4f6836c0eb (diff)
downloadlibgit2-c7b79af3f035b06095ba9d9ad61c3c766764b818.tar.gz
pack-odb: Check `mtime` instead of folder size
Do not check the folder's size to detect new packfiles at runtime. This doesn't work on Win32.
Diffstat (limited to 'src/odb_pack.c')
-rw-r--r--src/odb_pack.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/odb_pack.c b/src/odb_pack.c
index 40ef48faf..940750e1c 100644
--- a/src/odb_pack.c
+++ b/src/odb_pack.c
@@ -113,7 +113,7 @@ struct pack_backend {
git_vector packs;
struct pack_file *last_found;
char *pack_folder;
- size_t pack_folder_size;
+ time_t pack_folder_mtime;
size_t window_size; /* needs default value */
@@ -874,7 +874,7 @@ static int packfile_refresh_all(struct pack_backend *backend)
if (gitfo_stat(backend->pack_folder, &st) < 0 || !S_ISDIR(st.st_mode))
return GIT_ENOTFOUND;
- if ((size_t)st.st_size != backend->pack_folder_size) {
+ if (st.st_mtime != backend->pack_folder_mtime) {
char path[GIT_PATH_MAX];
strcpy(path, backend->pack_folder);
@@ -884,7 +884,7 @@ static int packfile_refresh_all(struct pack_backend *backend)
return error;
git_vector_sort(&backend->packs);
- backend->pack_folder_size = (size_t)st.st_size;
+ backend->pack_folder_mtime = st.st_mtime;
}
return GIT_SUCCESS;
@@ -1408,7 +1408,7 @@ int git_odb_backend_pack(git_odb_backend **backend_out, const char *objects_dir)
git__joinpath(path, objects_dir, "pack");
if (gitfo_isdir(path) == GIT_SUCCESS) {
backend->pack_folder = git__strdup(path);
- backend->pack_folder_size = 0;
+ backend->pack_folder_mtime = 0;
if (backend->pack_folder == NULL) {
free(backend);