Skip to content
  • Duncan Coutts's avatar
    FileMonitor: handle changes during an update action · a15d0d77
    Duncan Coutts authored
    If we take the snapshot after the action has completed then we have a
    problem. The problem is that files might have changed while the action
    was running but /after/ the action read them. If we take the snapshot
    after the action completes then we will miss these changes.
    
    The solution is to record a timestamp before beginning execution of the
    action and then we make the conservative assumption that any file that
    has changed since then has already changed, ie the file monitor state
    for these files will be such that checkFileMonitorChanged will report
    that they have changed.
    
    Makes use of this in the Rebuild monad so everything using this will get
    the feature for free. Also adds a test.
    
    Changed the representation of files that have already changed by the
    time we take the snapshot. We had two extra constructor, but now instead
    we represent it with the normal constructors but with a Maybe ModTime.
    The reason is that it's easier to extend to the globbing case.
    a15d0d77