| ... | ... | @@ -508,13 +508,6 @@ pub const Manifest = struct { |
| 508 | 508 | metadata_only: bool = false, |
| 509 | 509 | }; |
| 510 | 510 | |
| 511 | | pub const AddInputPathError = error{ |
| 512 | | /// The same file path has been added to the cache manifest both as a |
| 513 | | /// directory and as a normal file, making the intended caching |
| 514 | | /// behavior ambiguous. |
| 515 | | IsDirectoryAmbiguous, |
| 516 | | } || Allocator.Error; |
| 517 | | |
| 518 | 511 | /// Add a file or directory path as a dependency of process being cached. |
| 519 | 512 | /// When `hit` is called, the contents will be checked to ensure |
| 520 | 513 | /// that it matches the contents from previous times. |
| ... | ... | @@ -530,7 +523,7 @@ pub const Manifest = struct { |
| 530 | 523 | /// |
| 531 | 524 | /// See also: |
| 532 | 525 | /// * `addPathPost` |
| 533 | | pub fn addInputPath(m: *Manifest, path: Path, options: AddInputPathOptions) AddInputPathError!InputPath.Index { |
| 526 | pub fn addInputPath(m: *Manifest, path: Path, options: AddInputPathOptions) Allocator.Error!InputPath.Index { |
| 534 | 527 | const gpa = m.cache.gpa; |
| 535 | 528 | try m.files.ensureUnusedCapacity(gpa, 1); |
| 536 | 529 | try m.input_paths.ensureUnusedCapacity(gpa, 1); |
| ... | ... | @@ -573,8 +566,10 @@ pub const Manifest = struct { |
| 573 | 566 | existing_header.inode = stat.inode; |
| 574 | 567 | existing_header.mtime = stat.mtime; |
| 575 | 568 | } |
| 576 | | if (existing_header.flags.is_directory != options.is_directory) |
| 577 | | return error.IsDirectoryAmbiguous; |
| 569 | // If it trips, the same file path has been added to the cache |
| 570 | // manifest both as a directory and as a normal file, making the |
| 571 | // intended caching behavior ambiguous. |
| 572 | assert(existing_header.flags.is_directory == options.is_directory); |
| 578 | 573 | if (!options.metadata_only) |
| 579 | 574 | existing_header.flags.metadata_only = false; |
| 580 | 575 | } else { |
| ... | ... | @@ -1078,12 +1073,7 @@ pub const Manifest = struct { |
| 1078 | 1073 | metadata_only: bool = false, |
| 1079 | 1074 | }; |
| 1080 | 1075 | |
| 1081 | | pub const AddPathPostError = error{ |
| 1082 | | /// The same file path has been added to the cache manifest both as a |
| 1083 | | /// directory and as a normal file, making the intended caching |
| 1084 | | /// behavior ambiguous. |
| 1085 | | IsDirectoryAmbiguous, |
| 1086 | | } || Io.Cancelable || Allocator.Error; |
| 1076 | pub const AddPathPostError = Io.Cancelable || Allocator.Error; |
| 1087 | 1077 | |
| 1088 | 1078 | /// Add a file as a dependency of process being cached, after cache miss |
| 1089 | 1079 | /// occurs. |
| ... | ... | @@ -1126,8 +1116,10 @@ pub const Manifest = struct { |
| 1126 | 1116 | m.contents.shrinkRetainingCapacity(prev_contents_len); |
| 1127 | 1117 | const existing_off = gop.key_ptr.*; |
| 1128 | 1118 | const header = existing_off.get(m); |
| 1129 | | if (header.flags.is_directory != is_directory) |
| 1130 | | return error.IsDirectoryAmbiguous; |
| 1119 | // If it trips, the same file path has been added to the cache |
| 1120 | // manifest both as a directory and as a normal file, making the |
| 1121 | // intended caching behavior ambiguous. |
| 1122 | assert(header.flags.is_directory == is_directory); |
| 1131 | 1123 | if (!options.metadata_only) |
| 1132 | 1124 | header.flags.metadata_only = false; |
| 1133 | 1125 | break :h header; |