libgit2/libgit2 — pull request #1032 by arrbee (2012-10-30 19:17:44+00:00)
Title: Add git_config_refresh() API to reload config

Addressing #1022, this adds a new `git_config_refresh()` API that allows users to reload the config if the file has changed on disk.

The modification time and file size are used to test if the file needs to be reloaded (and are now remembered in the disk backend object). That combination is hardly bulletproof, I realize, but that's what I've got.

The `git_config_file` object gained a new `refresh()` callback, so implementations besides the standard disk backend will have to be adjusted.

When writing tests, just using mtime was a problem / race, so I decided 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 config write).

Lastly, I moved some similar file modification checking code for attributes files into `fileops.c`. It is still only being used for attrs, but it seems potentially reusable, so I thought I'd move it over.