summaryrefslogtreecommitdiff
path: root/src/attr_file.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-10-30 12:10:36 -0700
committerRussell Belfer <rb@github.com>2012-10-30 12:11:23 -0700
commit744cc03e2b6d77712bfcb504c272d2e646da650c (patch)
tree6dd5c8cf23e02cf4a5b96800e19dc9749d08cc75 /src/attr_file.h
parentefde422553e1181933d0bc9d7112740e858a847b (diff)
downloadlibgit2-744cc03e2b6d77712bfcb504c272d2e646da650c.tar.gz
Add git_config_refresh() API to reload config
This adds a new API that allows users to reload the config if the file has changed on disk. A new config callback function to refresh the config was added. The modified time and file size are used to test if the file needs to be reloaded (and are now stored in the disk backend object). In writing tests, just using mtime was a problem / race, so I wanted to check file size as well. To support that, I extended `git_futils_readbuffer_updated` to optionally check file size in addition to mtime, and I added a new function `git_filebuf_stats` to fetch the mtime and size for an open filebuf (so that the config could be easily refreshed after a write). Lastly, I moved some similar file checking code for attributes into filebuf. It is still only being used for attrs, but it seems potentially reusable, so I thought I'd move it over.
Diffstat (limited to 'src/attr_file.h')
-rw-r--r--src/attr_file.h9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/attr_file.h b/src/attr_file.h
index 877daf306..ecd64866f 100644
--- a/src/attr_file.h
+++ b/src/attr_file.h
@@ -11,6 +11,7 @@
#include "vector.h"
#include "pool.h"
#include "buffer.h"
+#include "fileops.h"
#define GIT_ATTR_FILE ".gitattributes"
#define GIT_ATTR_FILE_INREPO "info/attributes"
@@ -54,19 +55,13 @@ typedef struct {
} git_attr_assignment;
typedef struct {
- git_time_t seconds;
- git_off_t size;
- unsigned int ino;
-} git_attr_file_stat_sig;
-
-typedef struct {
char *key; /* cache "source#path" this was loaded from */
git_vector rules; /* vector of <rule*> or <fnmatch*> */
git_pool *pool;
bool pool_is_allocated;
union {
git_oid oid;
- git_attr_file_stat_sig st;
+ git_futils_stat_sig sig;
} cache_data;
} git_attr_file;