Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f183d4635a |
Generated
+1
-1
@@ -1503,7 +1503,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "worklane"
|
name = "worklane"
|
||||||
version = "0.32.10"
|
version = "0.32.11"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"assert_cmd",
|
"assert_cmd",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "worklane"
|
name = "worklane"
|
||||||
version = "0.32.10"
|
version = "0.32.11"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
+4
-4
@@ -344,10 +344,10 @@ pub fn cmd_add(args: &AddArgs, start: &Path) -> Result<()> {
|
|||||||
// format allows: duplicate titles are supported and `add_allows_duplicate_titles`
|
// format allows: duplicate titles are supported and `add_allows_duplicate_titles`
|
||||||
// pins it. `cmd_campaign_add` deliberately does not carry it either. What is left is
|
// pins it. `cmd_campaign_add` deliberately does not carry it either. What is left is
|
||||||
// the write's own failure, named with the ticket and the path the way the other
|
// the write's own failure, named with the ticket and the path the way the other
|
||||||
// writes in the tree name them.
|
// writes in the tree name them. Staged like them too: there is no existing content
|
||||||
fs::write(&filepath, body).map_err(|e| {
|
// to corrupt, but a partial file in backlog is a ticket the listing would read, so
|
||||||
anyhow!("Could not write ticket '{}' at {}: {}", title, filepath.display(), e)
|
// the same writer as every edit is the one that makes the new file appear whole.
|
||||||
})?;
|
write_then_replace(&worklane_dir, &filepath, &filename, &body, TICKET, title)?;
|
||||||
|
|
||||||
println!("Created ticket: {}", filename);
|
println!("Created ticket: {}", filename);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -574,6 +574,12 @@ fn chmod(path: &Path, mode: u32) {
|
|||||||
/// itself, and it is named with the ticket and the path rather than raised as a bare io
|
/// itself, and it is named with the ticket and the path rather than raised as a bare io
|
||||||
/// error. The branch this replaces could not fire at all: the filename carries a fresh
|
/// error. The branch this replaces could not fire at all: the filename carries a fresh
|
||||||
/// uuid, and its message claimed the title was taken.
|
/// uuid, and its message claimed the title was taken.
|
||||||
|
///
|
||||||
|
/// The add stages through `write_then_replace` like every other write, so the temp
|
||||||
|
/// lives under `.worklane/`, outside the directory the chmod keeps closed, and the
|
||||||
|
/// rename is the step that fails here. Both halves have to be gone afterwards: no half
|
||||||
|
/// ticket in backlog, and no `.wl-*.tmp` beside it, which is what `stray_files` checks
|
||||||
|
/// for a move.
|
||||||
#[test]
|
#[test]
|
||||||
fn add_names_the_ticket_and_the_path_when_the_write_fails() {
|
fn add_names_the_ticket_and_the_path_when_the_write_fails() {
|
||||||
let temp = TempDir::new().unwrap();
|
let temp = TempDir::new().unwrap();
|
||||||
@@ -596,6 +602,14 @@ fn add_names_the_ticket_and_the_path_when_the_write_fails() {
|
|||||||
|
|
||||||
chmod(&backlog, 0o755);
|
chmod(&backlog, 0o755);
|
||||||
assert_eq!(fs::read_dir(&backlog).unwrap().count(), 0);
|
assert_eq!(fs::read_dir(&backlog).unwrap().count(), 0);
|
||||||
|
|
||||||
|
let strays: Vec<String> = fs::read_dir(&worklane)
|
||||||
|
.unwrap()
|
||||||
|
.filter_map(|e| e.ok())
|
||||||
|
.map(|e| e.file_name().into_string().unwrap())
|
||||||
|
.filter(|name| name.starts_with(".wl-"))
|
||||||
|
.collect();
|
||||||
|
assert_eq!(strays, Vec::<String>::new(), "the staging file was left behind");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The board above the project is real and empty, and stays empty: a dangling
|
/// The board above the project is real and empty, and stays empty: a dangling
|
||||||
|
|||||||
Reference in New Issue
Block a user