aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2021-06-23 23:14:25 +0200
committerTeddy Wing2021-06-23 23:14:25 +0200
commit8695d3845c154ea06a8e69dd0a4552ecc907dcb3 (patch)
tree15e27a31d71fd89e5a2d1f6f1b0c05e50af9f2c4
parent6c92eb6e7470dfb13f1b5aea8015db2b2937bb7e (diff)
downloadreflectub-8695d3845c154ea06a8e69dd0a4552ecc907dcb3.tar.bz2
update_mtime(): Idea for `.or_else()` chaining
An idea to chain the error handling here instead of using `match` expressions.
-rw-r--r--src/main.rs40
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,