FIX Remaking moved or deleted files
3 files changed, 121 insertions(+), 113 deletions(-)

M README.md
M README.org
M src/pds/pds.ml
M README.md +115 -106
@@ 2,62 2,63 @@ 
 
 # Table of Contents
 
-1.  [About](#org27913d6)
-    1.  [Why Does This Exist?](#orgbf46bfc)
-2.  [Parallelism](#orgd3d922e)
-3.  [Content Hash Based Builds](#org9f2f3b2)
-4.  [Terminology](#orgdc28572)
-5.  [Projects](#org649a08e)
-    1.  [Ocaml](#org9ddb4e5)
-    2.  [Third-party](#org7b99520)
-6.  [Dependencies](#orgea56d00)
-7.  [Configuration](#org14e2b4d)
-    1.  [Configuration Variables For Projects](#org3344c3b)
-    2.  [Configuration Variables For Tests](#orgbd24be8)
-    3.  [Outputting the configuration](#orga0701b9)
-8.  [Produced Files](#orga0feeea)
-9.  [Documentation](#org93fbfd2)
-10. [Selectors](#orge3be3e9)
-11. [Changelog](#org3afc856)
-    1.  [1.0.0](#org6090dfe)
-    2.  [1.1.0](#org1087efa)
-    3.  [2.0.0](#org4837bf9)
-    4.  [3.0.0](#org0858846)
-    5.  [3.0.1](#org461e1c4)
-    6.  [3.0.2](#org04e5f50)
-    7.  [3.0.3](#org18e020c)
-    8.  [3.0.4](#org19297ee)
-    9.  [3.1.0](#orga6961dd)
-    10. [3.1.1](#orge057ee2)
-    11. [4.11](#orgd5fcaf6)
-    12. [4.12](#orge696a30)
-    13. [4.13](#org194edfe)
-    14. [5.14](#org0b4c453)
-    15. [5.15](#orgeb4f836)
-    16. [5.16](#org9529da1)
-    17. [5.17 (bug release)](#orge4b8857)
-    18. [5.18](#orgd63f583)
-    19. [5.19](#orgebed321)
-    20. [6.20](#org48d6fed)
-    21. [5.21](#orgf5dbe2e)
-    22. [5.22](#org2a4829e)
-    23. [5.23](#org14012c0)
-    24. [5.24](#org39f4d76)
-    25. [5.25](#org4ac743f)
-    26. [5.26 (bug release)](#org9cc944f)
-    27. [5.27](#orgfb401f1)
-    28. [5.28](#org5e50c40)
-    29. [5.29](#orgd927605)
-    30. [6.43](#org2b1d22b)
-    31. [6.44](#org783e4cb)
-    32. [6.45](#org653a674)
-    33. [6.46](#orgc471fc3)
-    34. [6.47](#orgb913730)
-    35. [6.48](#org7368de7)
-    36. [6.49](#org54789c2)
+1.  [About](#org02965e4)
+    1.  [Why Does This Exist?](#org294dbf8)
+2.  [Parallelism](#orgf516fe7)
+3.  [Content Hash Based Builds](#orgf880858)
+4.  [Terminology](#org7942aee)
+5.  [Projects](#orga86e50d)
+    1.  [Ocaml](#orge1b151f)
+    2.  [Third-party](#org4b0ac75)
+6.  [Dependencies](#orgbe9552e)
+7.  [Configuration](#orgdbf0f73)
+    1.  [Configuration Variables For Projects](#orgd33ba2b)
+    2.  [Configuration Variables For Tests](#orgcd63039)
+    3.  [Outputting the configuration](#org4064847)
+8.  [Produced Files](#orgeeca028)
+9.  [Documentation](#org8fce142)
+10. [Selectors](#org218b391)
+11. [Changelog](#orge07e873)
+    1.  [1.0.0](#orgabf8e18)
+    2.  [1.1.0](#org2823268)
+    3.  [2.0.0](#org80b5904)
+    4.  [3.0.0](#org1c16cfa)
+    5.  [3.0.1](#org547ee4e)
+    6.  [3.0.2](#org4e29cbf)
+    7.  [3.0.3](#org9a6a4e9)
+    8.  [3.0.4](#org3de5ad8)
+    9.  [3.1.0](#orgdb15021)
+    10. [3.1.1](#org0f81934)
+    11. [4.11](#org857cd2d)
+    12. [4.12](#org0d8a259)
+    13. [4.13](#orgcf52e1d)
+    14. [5.14](#orgcae44c0)
+    15. [5.15](#orgdfaec27)
+    16. [5.16](#orgd18ee2a)
+    17. [5.17 (bug release)](#org8465c9e)
+    18. [5.18](#org7219af1)
+    19. [5.19](#org785beb4)
+    20. [6.20](#org5c4f0b6)
+    21. [5.21](#orgabd4261)
+    22. [5.22](#orge892d05)
+    23. [5.23](#org68ab407)
+    24. [5.24](#org9a3b6fb)
+    25. [5.25](#orgb6db298)
+    26. [5.26 (bug release)](#org826e4b5)
+    27. [5.27](#orgd1360dd)
+    28. [5.28](#org37927e3)
+    29. [5.29](#orgd7e4b38)
+    30. [6.43](#orge80dc14)
+    31. [6.44](#org8371d9e)
+    32. [6.45](#org335bbc6)
+    33. [6.46](#org6113200)
+    34. [6.47](#org0b074fc)
+    35. [6.48](#org6b172de)
+    36. [6.49](#orgc49bf2b)
+    37. [6.50](#orgc7a8aa1)
 
 
-<a id="org27913d6"></a>
+<a id="org02965e4"></a>
 
 # About
 

          
@@ 124,7 125,7 @@ the `build` directory, for example `buil
 `build/test-release`.
 
 
-<a id="orgbf46bfc"></a>
+<a id="org294dbf8"></a>
 
 ## Why Does This Exist?
 

          
@@ 137,7 138,7 @@ the existing tooling then you should be 
 meant to be non-intrusive.
 
 
-<a id="orgd3d922e"></a>
+<a id="orgf516fe7"></a>
 
 # Parallelism
 

          
@@ 157,7 158,7 @@ the source of the `units Foo and Bar mak
 error.
 
 
-<a id="org9f2f3b2"></a>
+<a id="orgf880858"></a>
 
 # Content Hash Based Builds
 

          
@@ 177,7 178,7 @@ of the build configuration, this ensure 
 that causes a rebuild.
 
 
-<a id="orgdc28572"></a>
+<a id="org7942aee"></a>
 
 # Terminology
 

          
@@ 189,7 190,7 @@ that causes a rebuild.
     `library`, this applies only to ocaml projects..
 
 
-<a id="org649a08e"></a>
+<a id="orga86e50d"></a>
 
 # Projects
 

          
@@ 200,7 201,7 @@ interface, which is `release`, `debug`, 
 and `clean`.
 
 
-<a id="org9ddb4e5"></a>
+<a id="orge1b151f"></a>
 
 ## Ocaml
 

          
@@ 251,7 252,7 @@ generated.
 </table>
 
 
-<a id="org7b99520"></a>
+<a id="org4b0ac75"></a>
 
 ## Third-party
 

          
@@ 259,7 260,7 @@ Third party projects do not have a `Make
 to have one which corresponds to the pds interface.
 
 
-<a id="orgea56d00"></a>
+<a id="orgbe9552e"></a>
 
 # Dependencies
 

          
@@ 270,7 271,7 @@ compiled before its dependent project an
 as a dependency in the dependents `Makefile`.
 
 
-<a id="org14e2b4d"></a>
+<a id="orgdbf0f73"></a>
 
 # Configuration
 

          
@@ 324,7 325,7 @@ An example of building the example direc
     install = false
 
 
-<a id="org3344c3b"></a>
+<a id="orgd33ba2b"></a>
 
 ## Configuration Variables For Projects
 

          
@@ 474,7 475,7 @@ 5.  `src.<project>.<option>`
 The same precedence applies to test builds.
 
 
-<a id="orgbd24be8"></a>
+<a id="orgcd63039"></a>
 
 ## Configuration Variables For Tests
 

          
@@ 489,7 490,7 @@ 2.  `global.test-<build_type>.<option>`
 3.  `tests.<project>.<option>`
 
 
-<a id="orga0701b9"></a>
+<a id="org4064847"></a>
 
 ## Outputting the configuration
 

          
@@ 546,7 547,7 @@ output looks like the following:
 </table>
 
 
-<a id="orga0feeea"></a>
+<a id="orgeeca028"></a>
 
 # Produced Files
 

          
@@ 559,7 560,7 @@ ignored in the form of a `.gitignore`.
     Ocamlrules.mk.in
 
 
-<a id="org93fbfd2"></a>
+<a id="org8fce142"></a>
 
 # Documentation
 

          
@@ 573,7 574,7 @@ also be set for `ocamldoc` by modifying 
 `extra_makefile_lines`.
 
 
-<a id="orge3be3e9"></a>
+<a id="org218b391"></a>
 
 # Selectors
 

          
@@ 617,12 618,12 @@ The order of precedence is that the sele
 checked, then the selector for a release.
 
 
-<a id="org3afc856"></a>
+<a id="orge07e873"></a>
 
 # Changelog
 
 
-<a id="org6090dfe"></a>
+<a id="orgabf8e18"></a>
 
 ## 1.0.0
 

          
@@ 631,7 632,7 @@ checked, then the selector for a release
 -   Support running tests.
 
 
-<a id="org1087efa"></a>
+<a id="org2823268"></a>
 
 ## 1.1.0
 

          
@@ 640,7 641,7 @@ checked, then the selector for a release
     is useful if a tool needs to be built that will be used to compile a project.
 
 
-<a id="org4837bf9"></a>
+<a id="org80b5904"></a>
 
 ## 2.0.0
 

          
@@ 649,7 650,7 @@ checked, then the selector for a release
 -   Fill out the documentation more.
 
 
-<a id="org0858846"></a>
+<a id="org1c16cfa"></a>
 
 ## 3.0.0
 

          
@@ 657,7 658,7 @@ checked, then the selector for a release
     understands both installing and uninstalling projects.
 
 
-<a id="org461e1c4"></a>
+<a id="org547ee4e"></a>
 
 ## 3.0.1
 

          
@@ 665,14 666,14 @@ checked, then the selector for a release
     after using hll to make the package.
 
 
-<a id="org04e5f50"></a>
+<a id="org4e29cbf"></a>
 
 ## 3.0.2
 
 -   Expand the hll config to pass opam-linter.
 
 
-<a id="org18e020c"></a>
+<a id="org9a6a4e9"></a>
 
 ## 3.0.3
 

          
@@ 680,7 681,7 @@ checked, then the selector for a release
 -   Specify which version of ocaml pds works with.
 
 
-<a id="org19297ee"></a>
+<a id="org3de5ad8"></a>
 
 ## 3.0.4
 

          
@@ 688,7 689,7 @@ checked, then the selector for a release
 -   Remove examples.
 
 
-<a id="orga6961dd"></a>
+<a id="orgdb15021"></a>
 
 ## 3.1.0
 

          
@@ 696,14 697,14 @@ checked, then the selector for a release
 -   Install `.cmi` files.
 
 
-<a id="orge057ee2"></a>
+<a id="org0f81934"></a>
 
 ## 3.1.1
 
 -   Fix a bug in generating docs when the project has no dependencies.
 
 
-<a id="orgd5fcaf6"></a>
+<a id="org857cd2d"></a>
 
 ## 4.11
 

          
@@ 714,21 715,21 @@ checked, then the selector for a release
     name of the output.
 
 
-<a id="orge696a30"></a>
+<a id="org0d8a259"></a>
 
 ## 4.12
 
 -   Include tests directories in formatted output.
 
 
-<a id="org194edfe"></a>
+<a id="orgcf52e1d"></a>
 
 ## 4.13
 
 -   Make a better error message for the install key, which is required.
 
 
-<a id="org0b4c453"></a>
+<a id="orgcae44c0"></a>
 
 ## 5.14
 

          
@@ 738,7 739,7 @@ checked, then the selector for a release
 -   Remove PACK support.  Building PACKs is no longer supported.
 
 
-<a id="orgeb4f836"></a>
+<a id="orgdfaec27"></a>
 
 ## 5.15
 

          
@@ 746,14 747,14 @@ checked, then the selector for a release
 -   Add a changelog and back fill it.
 
 
-<a id="org9529da1"></a>
+<a id="orgd18ee2a"></a>
 
 ## 5.16
 
 -   Fix bug in cleanup logic which concatenated multiple deps
 
 
-<a id="orge4b8857"></a>
+<a id="org8465c9e"></a>
 
 ## 5.17 (bug release)
 

          
@@ 764,7 765,7 @@ checked, then the selector for a release
     first then the .cmo and .cmx are generated.
 
 
-<a id="orgd63f583"></a>
+<a id="org7219af1"></a>
 
 ## 5.18
 

          
@@ 777,7 778,7 @@ checked, then the selector for a release
     it.  This solves it by serializing the build for those cases.
 
 
-<a id="orgebed321"></a>
+<a id="org785beb4"></a>
 
 ## 5.19
 

          
@@ 785,14 786,14 @@ checked, then the selector for a release
     installs `.cmi` files for all `.ml` files.
 
 
-<a id="org48d6fed"></a>
+<a id="org5c4f0b6"></a>
 
 ## 6.20
 
 -   Removed the `-custom` option from default byte code builds.
 
 
-<a id="orgf5dbe2e"></a>
+<a id="orgabd4261"></a>
 
 ## 5.21
 

          
@@ 800,7 801,7 @@ checked, then the selector for a release
     them to be overridden.
 
 
-<a id="org2a4829e"></a>
+<a id="orge892d05"></a>
 
 ## 5.22
 

          
@@ 808,28 809,28 @@ checked, then the selector for a release
 -   Tests compile with `OCAML*_LINK_OPTS` just like regular builds.
 
 
-<a id="org14012c0"></a>
+<a id="org68ab407"></a>
 
 ## 5.23
 
 -   Fix typo in PARALLEL
 
 
-<a id="org39f4d76"></a>
+<a id="org9a3b6fb"></a>
 
 ## 5.24
 
 -   Build cmti files and install them for every library.
 
 
-<a id="org4ac743f"></a>
+<a id="orgb6db298"></a>
 
 ## 5.25
 
 -   Support adding linkopts to the META file.
 
 
-<a id="org9cc944f"></a>
+<a id="org826e4b5"></a>
 
 ## 5.26 (bug release)
 

          
@@ 837,14 838,14 @@ checked, then the selector for a release
 -   Add some tests.
 
 
-<a id="orgfb401f1"></a>
+<a id="orgd1360dd"></a>
 
 ## 5.27
 
 -   Fix bug in section name for the selector.
 
 
-<a id="org5e50c40"></a>
+<a id="org37927e3"></a>
 
 ## 5.28
 

          
@@ 852,7 853,7 @@ checked, then the selector for a release
     were not properly looked up.
 
 
-<a id="orgd927605"></a>
+<a id="orgd7e4b38"></a>
 
 ## 5.29
 

          
@@ 861,51 862,59 @@ checked, then the selector for a release
     worked).
 
 
-<a id="org2b1d22b"></a>
+<a id="orge80dc14"></a>
 
 ## 6.43
 
 -   Move to content based hashing.
 
 
-<a id="org783e4cb"></a>
+<a id="org8371d9e"></a>
 
 ## 6.44
 
 -   Fix install directive
 
 
-<a id="org653a674"></a>
+<a id="org335bbc6"></a>
 
 ## 6.45
 
 -   Better sqlite error reporting
 
 
-<a id="orgc471fc3"></a>
+<a id="org6113200"></a>
 
 ## 6.46
 
 -   strftime usage that works on Alpine
 
 
-<a id="orgb913730"></a>
+<a id="org0b074fc"></a>
 
 ## 6.47
 
 -   Another instance of strftime
 
 
-<a id="org7368de7"></a>
+<a id="org6b172de"></a>
 
 ## 6.48
 
 -   Fix bugs in testing outputs.
 
 
-<a id="org54789c2"></a>
+<a id="orgc49bf2b"></a>
 
 ## 6.49
 
 -   Improve performance 10x by batching database operations.
 
+
+<a id="orgc7a8aa1"></a>
+
+## 6.50
+
+-   Fix handling file renames or deletes.  Pds would remake the file, thinking
+    that its hash had been changed, when in reality it didn't exist.
+

          
M README.org +3 -0
@@ 432,3 432,6 @@ checked, then the selector for a release
 - Fix bugs in testing outputs.
 ** 6.49
 - Improve performance 10x by batching database operations.
+** 6.50
+- Fix handling file renames or deletes.  Pds would remake the file, thinking
+  that its hash had been changed, when in reality it didn't exist.

          
M src/pds/pds.ml +3 -7
@@ 103,7 103,7 @@ module Hash_db = struct
     let stmt =
       Sqlite3.prepare
         db
-        "select lr.path from last_run as lr left join hashes on hashes.path = lr.path where \
+        "select lr.path from last_run as lr inner join hashes on hashes.path = lr.path where \
          hashes.hash <> lr.hash"
     in
     let rc, rows =

          
@@ 120,12 120,8 @@ module Hash_db = struct
       ignore
         (Unix.system
            (sprintf "touch -d '%s' " datetime ^ String.concat " " (List.map (sprintf "%S") rows)));
-    assert_rc
-    @@ Sqlite3.exec
-         db
-         "insert or replace into hashes select lr.path as path, lr.hash as hash, lr.modified_at as \
-          modified_at from last_run as lr left join hashes on hashes.path = lr.path where \
-          hashes.path is null or  lr.hash <> hashes.hash";
+    assert_rc @@ Sqlite3.exec db "drop table hashes";
+    assert_rc @@ Sqlite3.exec db "alter table last_run rename to hashes";
     ignore (Sqlite3.db_close db);
     ()
 end