diff options
author | Adam Spragg <adam@spra.gg> | 2022-05-18 16:35:35 +0100 |
---|---|---|
committer | Adam Spragg <adam@spra.gg> | 2022-05-24 10:12:33 +0100 |
commit | 7292804c1bafd43389defc0d7b4352ada666d626 (patch) | |
tree | 9e0390c7f45dd20b7db92d3f64bdcecaa3d9c1dc /src/metaentry.h | |
parent | ce62a76e4570b6368384b3995c1ba106389df454 (diff) |
Add ability to not save mtime in metadata files
If you're storing metadata in a version control system with multiple
branches, mtime differences are going to produce a whole bunch of
conflicts that you likely don't care about. This allows you to not
save mtime and avoid those.
Note that we use a sentinel value of -1 for the mentry `mtimensec` field
to indicate this in the data, as all values of `mtime` are theoretically
valid, but `mtimensec` must always be between 0 and 999,999,999 in the
real world.
I'm not 100% sure about the mechanism for selecting this feature. The
legacy behaviour for metastore was to save mtimes in the metadata files,
but ignore them for compare/apply by default, with a `--mtime` option to
use the mtime data.
Keeping the legacy behaviour for backwards compatibility, but adding a
`--no-mtime` option to ignore mtimes when saving felt like a reasonable
way of making this happen, but something about it doesn't feel great.
Maybe I just didn't figure out how to make the documentation clear
enough. ¯\_(ツ)_/¯
Diffstat (limited to 'src/metaentry.h')
-rw-r--r-- | src/metaentry.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/metaentry.h b/src/metaentry.h index a6de66b..6c97961 100644 --- a/src/metaentry.h +++ b/src/metaentry.h @@ -54,7 +54,7 @@ struct metahash { }; /* Create a metaentry for the file/dir/etc at path */ -struct metaentry *mentry_create(const char *path); +struct metaentry *mentry_create(const char *path, int with_mtime); /* Recurses opath and adds metadata entries to the metaentry list */ void mentries_recurse_path(const char *opath, struct metahash **mhash, |