Create symlinks in near future when merging

Summary:public
It could happen that the modification times of symbolic links and
original files checked by reactive mode could be exactly the same.  In
this case, some files would perpetually be re-analyzed.

This diff creates symlinks and sets their accessed and modified times
to 1 second in the future so that strict timestamp checking is robust.

Reviewed By: cristianoc

Differential Revision: D3098451

fb-gh-sync-id: 3724468
fbshipit-source-id: 3724468
master
Josh Berdine 9 years ago committed by Facebook Github Bot 1
parent c8b87ed0c8
commit 9539b430f7

@ -337,7 +337,7 @@ let infer_start_time = lazy
let file_was_updated_after_start fname =
if file_exists fname then
let file_mtime = file_modified_time fname in
file_mtime >= Lazy.force infer_start_time
file_mtime > Lazy.force infer_start_time
else
(* since file doesn't exist, it wasn't modified *)
false

@ -63,6 +63,12 @@ let rec slink ~stats src dst =
begin
if Sys.file_exists dst then Sys.remove dst;
Unix.symlink src dst;
(* Set the accessed and modified time of the new symlink to be slightly in the future. Due to
the coarse precision of the timestamps, it is possible for the source and destination of a
link to have the same modification time. When this happens, the files will be considered to
need re-analysis every time, indefinitely. *)
let near_future = Unix.gettimeofday () +. 1. in
Unix.utimes dst near_future near_future ;
stats.files_linked <- stats.files_linked + 1;
end

Loading…
Cancel
Save