Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7499eae

Browse files
committed
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.
1 parent 99a09f7 commit 7499eae

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/diff.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,8 +493,10 @@ static int diff_list_apply_options(
493493

494494
/* Don't set GIT_DIFFCAPS_USE_DEV - compile time option in core git */
495495

496-
/* Set GIT_DIFFCAPS_TRUST_NANOSECS on a platform basis */
496+
/* Don't trust nanoseconds; we do not load nanos from disk */
497+
#ifdef GIT_USE_NSEC
497498
diff->diffcaps = diff->diffcaps | GIT_DIFFCAPS_TRUST_NANOSECS;
499+
#endif
498500

499501
/* If not given explicit `opts`, check `diff.xyz` configs */
500502
if (!opts) {

0 commit comments

Comments
 (0)