summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2015-10-22 09:30:41 -0400
committerCarlos Martín Nieto <cmn@dwim.me>2015-11-04 17:13:19 -0800
commitba7da35ee0112e6b37fba26deaf713f59b9baea9 (patch)
tree62413fecd0e11f8532be3d696d01769e4a5c85a7
parent1073061edadeb3ad76fb0521f3554693479a6a7e (diff)
downloadlibgit2-ba7da35ee0112e6b37fba26deaf713f59b9baea9.tar.gz
diff: ignore nsecs when diffing
Although our index contains the literal time present in the index, we do not read nanoseconds from disk, and thus we should not use them in any comparisons, lest we always think our working directory is dirty. Guard this behind a `GIT_USE_NSECS` for future improvement.
-rw-r--r--src/diff.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/diff.c b/src/diff.c
index c1adcc662..9cde03e17 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -471,8 +471,10 @@ static int diff_list_apply_options(
/* Don't set GIT_DIFFCAPS_USE_DEV - compile time option in core git */
- /* Set GIT_DIFFCAPS_TRUST_NANOSECS on a platform basis */
+ /* Don't trust nanoseconds; we do not load nanos from disk */
+#ifdef GIT_USE_NSEC
diff->diffcaps = diff->diffcaps | GIT_DIFFCAPS_TRUST_NANOSECS;
+#endif
/* If not given explicit `opts`, check `diff.xyz` configs */
if (!opts) {