diff options
| author | Teddy Wing | 2021-06-23 23:14:25 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2021-06-23 23:14:25 +0200 | 
| commit | 8695d3845c154ea06a8e69dd0a4552ecc907dcb3 (patch) | |
| tree | 15e27a31d71fd89e5a2d1f6f1b0c05e50af9f2c4 /src/main.rs | |
| parent | 6c92eb6e7470dfb13f1b5aea8015db2b2937bb7e (diff) | |
| download | reflectub-8695d3845c154ea06a8e69dd0a4552ecc907dcb3.tar.bz2 | |
update_mtime(): Idea for `.or_else()` chaining
An idea to chain the error handling here instead of using `match`
expressions.
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 40 | 
1 files changed, 40 insertions, 0 deletions
| diff --git a/src/main.rs b/src/main.rs index f6e69f8..8f6b9bb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -325,6 +325,46 @@ fn update_mtime<P: AsRef<Path>>(          DateTime::parse_from_rfc3339(&repo.updated_at)?.into()      ); +    // filetime::set_file_times( +    //     &default_branch_ref, +    //     update_time, +    //     update_time, +    // ) +    //     .or_else(|e| { +    //         if (e.kind != io::ErrorKind::NotFound) { +    //             return Err(e); +    //         } +    // +    //         let packed_refs_path = repo_path +    //             .as_ref() +    //             .join("packed-refs"); +    // +    //         filetime::set_file_times( +    //             &packed_refs_path, +    //             update_time, +    //             update_time, +    //         ) +    //     }) +    //     .or_else(|e| { +    //         if (e.kind != io::ErrorKind::NotFound) { +    //             return Err(e); +    //         } +    // +    //         let packed_refs_path = repo_path +    //             .as_ref() +    //             .join("packed-refs"); +    // +    //         filetime::set_file_times( +    //             &packed_refs_path, +    //             update_time, +    //             update_time, +    //         ) +    //     }) +    //     .with_context(|| format!( +    //         "unable to set mtime on '{}'", +    //         &default_branch_ref.display(), +    //     ))?; +      // Try updating times on the default ref.      match filetime::set_file_times(          &default_branch_ref, | 
