summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2015-10-22 09:30:41 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2015-10-22 09:35:47 -0400
commit7499eae98aaf15805882c3db16b661d76260af79 (patch)
treea8b8fdc4c977d2b57024ac12bf25c726dd4ff5c6
parent99a09f7f18f321c2a37e483bcd8aeb6dff781abc (diff)
downloadlibgit2-7499eae98aaf15805882c3db16b661d76260af79.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 d97dcd9d2..d98a28966 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -493,8 +493,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) {