Skip to content

Commit 965b5f2

Browse files
committed
chore: cargo update
1 parent 6c49c25 commit 965b5f2

File tree

2 files changed

+64
-26
lines changed

2 files changed

+64
-26
lines changed

Cargo.lock

Lines changed: 54 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ fn find_git_dir(path: &str) -> Result<Vec<PathBuf>> {
8787
Ok(found)
8888
}
8989

90-
/// Represents a workspace which is just a collection of repositories.
90+
/// A `Workspace` is filesystem directory containing git repositories checked out
91+
/// from one or more remotes. Each repository's path matches the remote's path,
92+
/// for example:
93+
/// <workspace path>/github.com/cilki/wsx
9194
#[derive(Debug, Serialize, Deserialize)]
9295
pub struct Workspace {
9396
/// A user-friendly name for the workspace like "personal" or "work"
@@ -121,23 +124,24 @@ pub struct Provider {
121124
pub name: String,
122125
}
123126

124-
/// Represents a workspace cache which is just a collection of bare repositories.
127+
/// Caches repositories that are dropped from a `Workspace` in a separate directory.
128+
/// Entries in this cache are bare repositories for space efficiency.
125129
#[derive(Debug, Serialize, Deserialize)]
126130
pub struct Cache {
127-
pub cache: String,
131+
pub path: String,
128132
}
129133

130134
impl Cache {
131135
/// Move the given repository into the cache.
132136
pub fn cache(&self, repo_path: String) -> Result<()> {
133137
// Make sure the cache directory exists first
134-
std::fs::create_dir_all(&self.cache)?;
138+
std::fs::create_dir_all(&self.path)?;
135139

136140
let source = format!("{}/.git", repo_path);
137141
let dest = self.compute_cache_key(&repo_path);
138142
run_fun!(git -C $source config core.bare true)?;
139143

140-
debug!("Caching '{}' -> '{}'", source, dest);
144+
debug!(source = %source, dest = %dest, "Caching repository");
141145

142146
// Clear the cache entry if it exists
143147
std::fs::remove_dir_all(&dest).ok();
@@ -162,7 +166,7 @@ impl Cache {
162166
fn compute_cache_key(&self, path: &str) -> String {
163167
format!(
164168
"{}/{:x}",
165-
self.cache,
169+
self.path,
166170
Sha512::new().chain_update(path).finalize()
167171
)
168172
}

0 commit comments

Comments
 (0)