From ef8a648cf8d6f60ac82c0017bec930459e3a76f3 Mon Sep 17 00:00:00 2001 From: Sebastian Kuzminsky Date: Thu, 24 Jul 2025 08:36:25 -0600 Subject: [PATCH 01/15] test dir cleanup: rename test/0000/3943fc5c173fdf41c0a22251593cd476 Renaming everything also means they have new creation-times, since we're now git logging a different file/dir. --- src/issue.rs | 6 +++--- src/issues.rs | 4 ++-- .../description | 0 .../tags | 0 4 files changed, 5 insertions(+), 5 deletions(-) rename test/0000/{3943fc5c173fdf41c0a22251593cd476d96e6c9f => 3943fc5c173fdf41c0a22251593cd476}/description (100%) rename test/0000/{3943fc5c173fdf41c0a22251593cd476d96e6c9f => 3943fc5c173fdf41c0a22251593cd476}/tags (100%) diff --git a/src/issue.rs b/src/issue.rs index 6f5889e..3e13a7d 100644 --- a/src/issue.rs +++ b/src/issue.rs @@ -553,12 +553,12 @@ mod tests { #[test] fn read_issue_0() { - let issue_dir = std::path::Path::new("test/0000/3943fc5c173fdf41c0a22251593cd476d96e6c9f/"); + let issue_dir = std::path::Path::new("test/0000/3943fc5c173fdf41c0a22251593cd476/"); let issue = Issue::new_from_dir(issue_dir).unwrap(); let expected = Issue { - id: String::from("3943fc5c173fdf41c0a22251593cd476d96e6c9f"), + id: String::from("3943fc5c173fdf41c0a22251593cd476"), author: String::from("Sebastian Kuzminsky "), - creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-03T12:14:26-06:00") + creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-24T08:36:25-06:00") .unwrap() .with_timezone(&chrono::Local), done_time: None, diff --git a/src/issues.rs b/src/issues.rs index fc182e7..11cb233 100644 --- a/src/issues.rs +++ b/src/issues.rs @@ -115,14 +115,14 @@ mod tests { dir, }); - let uuid = String::from("3943fc5c173fdf41c0a22251593cd476d96e6c9f"); + let uuid = String::from("3943fc5c173fdf41c0a22251593cd476"); let mut dir = std::path::PathBuf::from(issues_dir); dir.push(&uuid); expected.add_issue( crate::issue::Issue { id: uuid, author: String::from("Sebastian Kuzminsky "), - creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-03T12:14:26-06:00") + creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-24T08:36:25-06:00") .unwrap() .with_timezone(&chrono::Local), done_time: None, diff --git a/test/0000/3943fc5c173fdf41c0a22251593cd476d96e6c9f/description b/test/0000/3943fc5c173fdf41c0a22251593cd476/description similarity index 100% rename from test/0000/3943fc5c173fdf41c0a22251593cd476d96e6c9f/description rename to test/0000/3943fc5c173fdf41c0a22251593cd476/description diff --git a/test/0000/3943fc5c173fdf41c0a22251593cd476d96e6c9f/tags b/test/0000/3943fc5c173fdf41c0a22251593cd476/tags similarity index 100% rename from test/0000/3943fc5c173fdf41c0a22251593cd476d96e6c9f/tags rename to test/0000/3943fc5c173fdf41c0a22251593cd476/tags From 4683760942d33f99c50e321c3a901c0fc619da96 Mon Sep 17 00:00:00 2001 From: Sebastian Kuzminsky Date: Thu, 24 Jul 2025 08:37:07 -0600 Subject: [PATCH 02/15] test dir cleanup: rename test/0000/7792b063eef6d33e7da5dc1856750c14 Renaming everything also means they have new creation-times, since we're now git logging a different file/dir. --- src/issue.rs | 6 +++--- src/issues.rs | 4 ++-- .../assignee | 0 .../description | 0 .../state | 0 5 files changed, 5 insertions(+), 5 deletions(-) rename test/0000/{7792b063eef6d33e7da5dc1856750c149ba678c6 => 7792b063eef6d33e7da5dc1856750c14}/assignee (100%) rename test/0000/{7792b063eef6d33e7da5dc1856750c149ba678c6 => 7792b063eef6d33e7da5dc1856750c14}/description (100%) rename test/0000/{7792b063eef6d33e7da5dc1856750c149ba678c6 => 7792b063eef6d33e7da5dc1856750c14}/state (100%) diff --git a/src/issue.rs b/src/issue.rs index 3e13a7d..06f959f 100644 --- a/src/issue.rs +++ b/src/issue.rs @@ -581,12 +581,12 @@ mod tests { #[test] fn read_issue_1() { - let issue_dir = std::path::Path::new("test/0000/7792b063eef6d33e7da5dc1856750c149ba678c6/"); + let issue_dir = std::path::Path::new("test/0000/7792b063eef6d33e7da5dc1856750c14/"); let issue = Issue::new_from_dir(issue_dir).unwrap(); let expected = Issue { - id: String::from("7792b063eef6d33e7da5dc1856750c149ba678c6"), + id: String::from("7792b063eef6d33e7da5dc1856750c14"), author: String::from("Sebastian Kuzminsky "), - creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-03T12:14:26-06:00") + creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-24T08:37:07-06:00") .unwrap() .with_timezone(&chrono::Local), done_time: None, diff --git a/src/issues.rs b/src/issues.rs index 11cb233..db32737 100644 --- a/src/issues.rs +++ b/src/issues.rs @@ -96,13 +96,13 @@ mod tests { let mut expected = Issues::new(); - let uuid = String::from("7792b063eef6d33e7da5dc1856750c149ba678c6"); + let uuid = String::from("7792b063eef6d33e7da5dc1856750c14"); let mut dir = std::path::PathBuf::from(issues_dir); dir.push(&uuid); expected.add_issue(crate::issue::Issue { id: uuid, author: String::from("Sebastian Kuzminsky "), - creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-03T12:14:26-06:00") + creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-24T08:37:07-06:00") .unwrap() .with_timezone(&chrono::Local), done_time: None, diff --git a/test/0000/7792b063eef6d33e7da5dc1856750c149ba678c6/assignee b/test/0000/7792b063eef6d33e7da5dc1856750c14/assignee similarity index 100% rename from test/0000/7792b063eef6d33e7da5dc1856750c149ba678c6/assignee rename to test/0000/7792b063eef6d33e7da5dc1856750c14/assignee diff --git a/test/0000/7792b063eef6d33e7da5dc1856750c149ba678c6/description b/test/0000/7792b063eef6d33e7da5dc1856750c14/description similarity index 100% rename from test/0000/7792b063eef6d33e7da5dc1856750c149ba678c6/description rename to test/0000/7792b063eef6d33e7da5dc1856750c14/description diff --git a/test/0000/7792b063eef6d33e7da5dc1856750c149ba678c6/state b/test/0000/7792b063eef6d33e7da5dc1856750c14/state similarity index 100% rename from test/0000/7792b063eef6d33e7da5dc1856750c149ba678c6/state rename to test/0000/7792b063eef6d33e7da5dc1856750c14/state From 694d127638842de94ef646819be71e1e1bb86255 Mon Sep 17 00:00:00 2001 From: Sebastian Kuzminsky Date: Thu, 24 Jul 2025 08:37:46 -0600 Subject: [PATCH 03/15] test dir cleanup: rename test/0001/3fa5bfd93317ad25772680071d5ac325 Renaming everything also means they have new creation-times, since we're now git logging a different file/dir. --- src/issues.rs | 4 ++-- .../description | 0 .../done_time | 0 .../state | 0 4 files changed, 2 insertions(+), 2 deletions(-) rename test/0001/{3fa5bfd93317ad25772680071d5ac3259cd2384f => 3fa5bfd93317ad25772680071d5ac325}/description (100%) rename test/0001/{3fa5bfd93317ad25772680071d5ac3259cd2384f => 3fa5bfd93317ad25772680071d5ac325}/done_time (100%) rename test/0001/{3fa5bfd93317ad25772680071d5ac3259cd2384f => 3fa5bfd93317ad25772680071d5ac325}/state (100%) diff --git a/src/issues.rs b/src/issues.rs index db32737..bd8d687 100644 --- a/src/issues.rs +++ b/src/issues.rs @@ -149,13 +149,13 @@ mod tests { let mut expected = Issues::new(); - let uuid = String::from("3fa5bfd93317ad25772680071d5ac3259cd2384f"); + let uuid = String::from("3fa5bfd93317ad25772680071d5ac325"); let mut dir = std::path::PathBuf::from(issues_dir); dir.push(&uuid); expected.add_issue(crate::issue::Issue { id: uuid, author: String::from("Sebastian Kuzminsky "), - creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-03T11:59:44-06:00") + creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-24T08:37:46-06:00") .unwrap() .with_timezone(&chrono::Local), done_time: Some( diff --git a/test/0001/3fa5bfd93317ad25772680071d5ac3259cd2384f/description b/test/0001/3fa5bfd93317ad25772680071d5ac325/description similarity index 100% rename from test/0001/3fa5bfd93317ad25772680071d5ac3259cd2384f/description rename to test/0001/3fa5bfd93317ad25772680071d5ac325/description diff --git a/test/0001/3fa5bfd93317ad25772680071d5ac3259cd2384f/done_time b/test/0001/3fa5bfd93317ad25772680071d5ac325/done_time similarity index 100% rename from test/0001/3fa5bfd93317ad25772680071d5ac3259cd2384f/done_time rename to test/0001/3fa5bfd93317ad25772680071d5ac325/done_time diff --git a/test/0001/3fa5bfd93317ad25772680071d5ac3259cd2384f/state b/test/0001/3fa5bfd93317ad25772680071d5ac325/state similarity index 100% rename from test/0001/3fa5bfd93317ad25772680071d5ac3259cd2384f/state rename to test/0001/3fa5bfd93317ad25772680071d5ac325/state From 05c7c6f4416f23d8d71b54e80ca2a0683bad2b2c Mon Sep 17 00:00:00 2001 From: Sebastian Kuzminsky Date: Thu, 24 Jul 2025 10:08:24 -0600 Subject: [PATCH 04/15] test dir cleanup: rename test/0001/dd79c8cfb8beeacd0460429944b4ecbe Renaming everything also means they have new creation-times, since we're now git logging a different file/dir. fixup test/0001/dd79c8cfb8beeacd0460429944b4ecbe, no comment yet --- src/issues.rs | 15 +++------------ .../description | 0 .../state | 0 3 files changed, 3 insertions(+), 12 deletions(-) rename test/0001/{dd79c8cfb8beeacd0460429944b4ecbe95a31561 => dd79c8cfb8beeacd0460429944b4ecbe}/description (100%) rename test/0001/{dd79c8cfb8beeacd0460429944b4ecbe95a31561 => dd79c8cfb8beeacd0460429944b4ecbe}/state (100%) diff --git a/src/issues.rs b/src/issues.rs index bd8d687..e8b759f 100644 --- a/src/issues.rs +++ b/src/issues.rs @@ -172,28 +172,19 @@ mod tests { dir, }); - let uuid = String::from("dd79c8cfb8beeacd0460429944b4ecbe95a31561"); + let uuid = String::from("dd79c8cfb8beeacd0460429944b4ecbe"); let mut dir = std::path::PathBuf::from(issues_dir); dir.push(&uuid); let mut comment_dir = dir.clone(); let comment_uuid = String::from("9055dac36045fe36545bed7ae7b49347"); comment_dir.push("comments"); comment_dir.push(&comment_uuid); - let mut expected_comments = Vec::::new(); - expected_comments.push( - crate::comment::Comment { - uuid: comment_uuid, - author: String::from("Sebastian Kuzminsky "), - creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-07T15:26:26-06:00").unwrap().with_timezone(&chrono::Local), - description: String::from("This is a comment on issue dd79c8cfb8beeacd0460429944b4ecbe95a31561\n\nIt has multiple lines\n"), - dir: std::path::PathBuf::from(comment_dir), - } - ); + let expected_comments = Vec::::new(); expected.add_issue( crate::issue::Issue { id: uuid, author: String::from("Sebastian Kuzminsky "), - creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-03T11:59:44-06:00") + creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-24T10:08:24-06:00") .unwrap() .with_timezone(&chrono::Local), done_time: None, diff --git a/test/0001/dd79c8cfb8beeacd0460429944b4ecbe95a31561/description b/test/0001/dd79c8cfb8beeacd0460429944b4ecbe/description similarity index 100% rename from test/0001/dd79c8cfb8beeacd0460429944b4ecbe95a31561/description rename to test/0001/dd79c8cfb8beeacd0460429944b4ecbe/description diff --git a/test/0001/dd79c8cfb8beeacd0460429944b4ecbe95a31561/state b/test/0001/dd79c8cfb8beeacd0460429944b4ecbe/state similarity index 100% rename from test/0001/dd79c8cfb8beeacd0460429944b4ecbe95a31561/state rename to test/0001/dd79c8cfb8beeacd0460429944b4ecbe/state From 598f4e5df838618584ca81e1edceb9d6791b228e Mon Sep 17 00:00:00 2001 From: Sebastian Kuzminsky Date: Thu, 24 Jul 2025 10:08:38 -0600 Subject: [PATCH 05/15] test dir cleanup: rename test/0001/dd79c8cfb8beeacd0460429944b4ecbe comment Renaming everything also means they have new creation-times, since we're now git logging a different file/dir. --- src/comment.rs | 9 +++++---- src/issues.rs | 11 ++++++++++- .../9055dac36045fe36545bed7ae7b49347/description | 3 +++ .../9055dac36045fe36545bed7ae7b49347/description | 3 --- 4 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 test/0001/dd79c8cfb8beeacd0460429944b4ecbe/comments/9055dac36045fe36545bed7ae7b49347/description delete mode 100644 test/0001/dd79c8cfb8beeacd0460429944b4ecbe95a31561/comments/9055dac36045fe36545bed7ae7b49347/description diff --git a/src/comment.rs b/src/comment.rs index 9770d65..1fa2e36 100644 --- a/src/comment.rs +++ b/src/comment.rs @@ -212,16 +212,17 @@ mod tests { #[test] fn read_comment_0() { - let comment_dir = - std::path::Path::new("test/0001/dd79c8cfb8beeacd0460429944b4ecbe95a31561/comments/9055dac36045fe36545bed7ae7b49347"); + let comment_dir = std::path::Path::new( + "test/0001/dd79c8cfb8beeacd0460429944b4ecbe/comments/9055dac36045fe36545bed7ae7b49347", + ); let comment = Comment::new_from_dir(comment_dir).unwrap(); let expected = Comment { uuid: String::from("9055dac36045fe36545bed7ae7b49347"), author: String::from("Sebastian Kuzminsky "), - creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-07T15:26:26-06:00") + creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-24T10:08:38-06:00") .unwrap() .with_timezone(&chrono::Local), - description: String::from("This is a comment on issue dd79c8cfb8beeacd0460429944b4ecbe95a31561\n\nIt has multiple lines\n"), + description: String::from("This is a comment on issue dd79c8cfb8beeacd0460429944b4ecbe\n\nIt has multiple lines\n"), dir: std::path::PathBuf::from(comment_dir), }; assert_eq!(comment, expected); diff --git a/src/issues.rs b/src/issues.rs index e8b759f..8dca0cd 100644 --- a/src/issues.rs +++ b/src/issues.rs @@ -179,7 +179,16 @@ mod tests { let comment_uuid = String::from("9055dac36045fe36545bed7ae7b49347"); comment_dir.push("comments"); comment_dir.push(&comment_uuid); - let expected_comments = Vec::::new(); + let mut expected_comments = Vec::::new(); + expected_comments.push( + crate::comment::Comment { + uuid: comment_uuid, + author: String::from("Sebastian Kuzminsky "), + creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-24T10:08:38-06:00").unwrap().with_timezone(&chrono::Local), + description: String::from("This is a comment on issue dd79c8cfb8beeacd0460429944b4ecbe\n\nIt has multiple lines\n"), + dir: std::path::PathBuf::from(comment_dir), + } + ); expected.add_issue( crate::issue::Issue { id: uuid, diff --git a/test/0001/dd79c8cfb8beeacd0460429944b4ecbe/comments/9055dac36045fe36545bed7ae7b49347/description b/test/0001/dd79c8cfb8beeacd0460429944b4ecbe/comments/9055dac36045fe36545bed7ae7b49347/description new file mode 100644 index 0000000..daa3d62 --- /dev/null +++ b/test/0001/dd79c8cfb8beeacd0460429944b4ecbe/comments/9055dac36045fe36545bed7ae7b49347/description @@ -0,0 +1,3 @@ +This is a comment on issue dd79c8cfb8beeacd0460429944b4ecbe + +It has multiple lines diff --git a/test/0001/dd79c8cfb8beeacd0460429944b4ecbe95a31561/comments/9055dac36045fe36545bed7ae7b49347/description b/test/0001/dd79c8cfb8beeacd0460429944b4ecbe95a31561/comments/9055dac36045fe36545bed7ae7b49347/description deleted file mode 100644 index f9de678..0000000 --- a/test/0001/dd79c8cfb8beeacd0460429944b4ecbe95a31561/comments/9055dac36045fe36545bed7ae7b49347/description +++ /dev/null @@ -1,3 +0,0 @@ -This is a comment on issue dd79c8cfb8beeacd0460429944b4ecbe95a31561 - -It has multiple lines From b3f5aaeb76652989c82cb9d2d655e8fec23cc81d Mon Sep 17 00:00:00 2001 From: sigil-03 Date: Thu, 24 Jul 2025 08:38:40 -0600 Subject: [PATCH 06/15] test dir cleanup: rename test/0002/3fa5bfd93317ad25772680071d5ac325 Renaming everything also means they have new creation-times, since we're now git logging a different file/dir. --- src/issues.rs | 4 ++-- .../description | 0 .../state | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename test/0002/{3fa5bfd93317ad25772680071d5ac3259cd2384f => 3fa5bfd93317ad25772680071d5ac325}/description (100%) rename test/0002/{3fa5bfd93317ad25772680071d5ac3259cd2384f => 3fa5bfd93317ad25772680071d5ac325}/state (100%) diff --git a/src/issues.rs b/src/issues.rs index 8dca0cd..e991880 100644 --- a/src/issues.rs +++ b/src/issues.rs @@ -216,13 +216,13 @@ mod tests { let mut expected = Issues::new(); - let uuid = String::from("3fa5bfd93317ad25772680071d5ac3259cd2384f"); + let uuid = String::from("3fa5bfd93317ad25772680071d5ac325"); let mut dir = std::path::PathBuf::from(issues_dir); dir.push(&uuid); expected.add_issue(crate::issue::Issue { id: uuid, author: String::from("sigil-03 "), - creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-05T13:55:49-06:00") + creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-24T08:38:40-06:00") .unwrap() .with_timezone(&chrono::Local), done_time: None, diff --git a/test/0002/3fa5bfd93317ad25772680071d5ac3259cd2384f/description b/test/0002/3fa5bfd93317ad25772680071d5ac325/description similarity index 100% rename from test/0002/3fa5bfd93317ad25772680071d5ac3259cd2384f/description rename to test/0002/3fa5bfd93317ad25772680071d5ac325/description diff --git a/test/0002/3fa5bfd93317ad25772680071d5ac3259cd2384f/state b/test/0002/3fa5bfd93317ad25772680071d5ac325/state similarity index 100% rename from test/0002/3fa5bfd93317ad25772680071d5ac3259cd2384f/state rename to test/0002/3fa5bfd93317ad25772680071d5ac325/state From b3903a9ed2e25214239ae796878c2ba9adc559bd Mon Sep 17 00:00:00 2001 From: sigil-03 Date: Thu, 24 Jul 2025 08:39:02 -0600 Subject: [PATCH 07/15] test dir cleanup: rename test/0002/a85f81fc5f14cb5d4851dd445dc9744c Renaming everything also means they have new creation-times, since we're now git logging a different file/dir. --- src/issues.rs | 8 ++++---- .../dependencies/3fa5bfd93317ad25772680071d5ac325} | 0 .../dependencies/dd79c8cfb8beeacd0460429944b4ecbe} | 0 .../description | 0 .../state | 0 5 files changed, 4 insertions(+), 4 deletions(-) rename test/0002/{a85f81fc5f14cb5d4851dd445dc9744c7f16ccc7/dependencies/3fa5bfd93317ad25772680071d5ac3259cd2384f => a85f81fc5f14cb5d4851dd445dc9744c/dependencies/3fa5bfd93317ad25772680071d5ac325} (100%) rename test/0002/{a85f81fc5f14cb5d4851dd445dc9744c7f16ccc7/dependencies/dd79c8cfb8beeacd0460429944b4ecbe95a31561 => a85f81fc5f14cb5d4851dd445dc9744c/dependencies/dd79c8cfb8beeacd0460429944b4ecbe} (100%) rename test/0002/{a85f81fc5f14cb5d4851dd445dc9744c7f16ccc7 => a85f81fc5f14cb5d4851dd445dc9744c}/description (100%) rename test/0002/{a85f81fc5f14cb5d4851dd445dc9744c7f16ccc7 => a85f81fc5f14cb5d4851dd445dc9744c}/state (100%) diff --git a/src/issues.rs b/src/issues.rs index e991880..f54fe87 100644 --- a/src/issues.rs +++ b/src/issues.rs @@ -256,22 +256,22 @@ mod tests { }, ); - let uuid = String::from("a85f81fc5f14cb5d4851dd445dc9744c7f16ccc7"); + let uuid = String::from("a85f81fc5f14cb5d4851dd445dc9744c"); let mut dir = std::path::PathBuf::from(issues_dir); dir.push(&uuid); expected.add_issue( crate::issue::Issue { id: uuid, author: String::from("sigil-03 "), - creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-05T13:55:49-06:00") + creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-24T08:39:02-06:00") .unwrap() .with_timezone(&chrono::Local), done_time: None, tags: Vec::::new(), state: crate::issue::State::WontDo, dependencies: Some(vec![ - crate::issue::IssueHandle::from("3fa5bfd93317ad25772680071d5ac3259cd2384f"), - crate::issue::IssueHandle::from("dd79c8cfb8beeacd0460429944b4ecbe95a31561"), + crate::issue::IssueHandle::from("3fa5bfd93317ad25772680071d5ac325"), + crate::issue::IssueHandle::from("dd79c8cfb8beeacd0460429944b4ecbe"), ]), assignee: None, description: String::from("issue with dependencies\n\na test has begun\nfor dependencies we seek\nintertwining life"), diff --git a/test/0002/a85f81fc5f14cb5d4851dd445dc9744c7f16ccc7/dependencies/3fa5bfd93317ad25772680071d5ac3259cd2384f b/test/0002/a85f81fc5f14cb5d4851dd445dc9744c/dependencies/3fa5bfd93317ad25772680071d5ac325 similarity index 100% rename from test/0002/a85f81fc5f14cb5d4851dd445dc9744c7f16ccc7/dependencies/3fa5bfd93317ad25772680071d5ac3259cd2384f rename to test/0002/a85f81fc5f14cb5d4851dd445dc9744c/dependencies/3fa5bfd93317ad25772680071d5ac325 diff --git a/test/0002/a85f81fc5f14cb5d4851dd445dc9744c7f16ccc7/dependencies/dd79c8cfb8beeacd0460429944b4ecbe95a31561 b/test/0002/a85f81fc5f14cb5d4851dd445dc9744c/dependencies/dd79c8cfb8beeacd0460429944b4ecbe similarity index 100% rename from test/0002/a85f81fc5f14cb5d4851dd445dc9744c7f16ccc7/dependencies/dd79c8cfb8beeacd0460429944b4ecbe95a31561 rename to test/0002/a85f81fc5f14cb5d4851dd445dc9744c/dependencies/dd79c8cfb8beeacd0460429944b4ecbe diff --git a/test/0002/a85f81fc5f14cb5d4851dd445dc9744c7f16ccc7/description b/test/0002/a85f81fc5f14cb5d4851dd445dc9744c/description similarity index 100% rename from test/0002/a85f81fc5f14cb5d4851dd445dc9744c7f16ccc7/description rename to test/0002/a85f81fc5f14cb5d4851dd445dc9744c/description diff --git a/test/0002/a85f81fc5f14cb5d4851dd445dc9744c7f16ccc7/state b/test/0002/a85f81fc5f14cb5d4851dd445dc9744c/state similarity index 100% rename from test/0002/a85f81fc5f14cb5d4851dd445dc9744c7f16ccc7/state rename to test/0002/a85f81fc5f14cb5d4851dd445dc9744c/state From fad23ba233adc90a34175281552c5eadace9f661 Mon Sep 17 00:00:00 2001 From: sigil-03 Date: Thu, 24 Jul 2025 08:39:20 -0600 Subject: [PATCH 08/15] test dir cleanup: rename test/0002/dd79c8cfb8beeacd0460429944b4ecbe Renaming everything also means they have new creation-times, since we're now git logging a different file/dir. --- src/issues.rs | 4 ++-- .../description | 0 .../state | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename test/0002/{dd79c8cfb8beeacd0460429944b4ecbe95a31561 => dd79c8cfb8beeacd0460429944b4ecbe}/description (100%) rename test/0002/{dd79c8cfb8beeacd0460429944b4ecbe95a31561 => dd79c8cfb8beeacd0460429944b4ecbe}/state (100%) diff --git a/src/issues.rs b/src/issues.rs index f54fe87..d3c57c0 100644 --- a/src/issues.rs +++ b/src/issues.rs @@ -235,14 +235,14 @@ mod tests { dir, }); - let uuid = String::from("dd79c8cfb8beeacd0460429944b4ecbe95a31561"); + let uuid = String::from("dd79c8cfb8beeacd0460429944b4ecbe"); let mut dir = std::path::PathBuf::from(issues_dir); dir.push(&uuid); expected.add_issue( crate::issue::Issue { id: uuid, author: String::from("sigil-03 "), - creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-05T13:55:49-06:00") + creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-24T08:39:20-06:00") .unwrap() .with_timezone(&chrono::Local), done_time: None, diff --git a/test/0002/dd79c8cfb8beeacd0460429944b4ecbe95a31561/description b/test/0002/dd79c8cfb8beeacd0460429944b4ecbe/description similarity index 100% rename from test/0002/dd79c8cfb8beeacd0460429944b4ecbe95a31561/description rename to test/0002/dd79c8cfb8beeacd0460429944b4ecbe/description diff --git a/test/0002/dd79c8cfb8beeacd0460429944b4ecbe95a31561/state b/test/0002/dd79c8cfb8beeacd0460429944b4ecbe/state similarity index 100% rename from test/0002/dd79c8cfb8beeacd0460429944b4ecbe95a31561/state rename to test/0002/dd79c8cfb8beeacd0460429944b4ecbe/state From 50f2b2a1bff348efc13c04d35440e5a6dadc1d66 Mon Sep 17 00:00:00 2001 From: Sebastian Kuzminsky Date: Sun, 20 Jul 2025 12:45:30 -0600 Subject: [PATCH 09/15] tags is now a directory with a file per tag This is more conflict resistant than the old encoding where tags was a file with a line per tag. --- src/issue.rs | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/issue.rs b/src/issue.rs index 06f959f..81559f4 100644 --- a/src/issue.rs +++ b/src/issue.rs @@ -137,13 +137,7 @@ impl Issue { } else if file_name == "dependencies" && direntry.metadata()?.is_dir() { dependencies = Self::read_dependencies(&direntry.path())?; } else if file_name == "tags" { - let contents = std::fs::read_to_string(direntry.path())?; - tags = contents - .lines() - .filter(|s| s.len() > 0) - .map(|tag| String::from(tag.trim())) - .collect(); - tags.sort(); + tags = Self::read_tags(&direntry)?; } else if file_name == "comments" && direntry.metadata()?.is_dir() { Self::read_comments(&mut comments, &direntry.path())?; } else { @@ -525,6 +519,21 @@ impl Issue { Ok(()) } + fn read_tags(tags_direntry: &std::fs::DirEntry) -> Result, IssueError> { + if !tags_direntry.metadata()?.is_dir() { + eprintln!("issue has old-style tags file"); + return Err(IssueError::IssueParseError); + } + let mut tags = Vec::::new(); + for direntry in tags_direntry.path().read_dir()? { + if let Ok(direntry) = direntry { + tags.push(String::from(direntry.file_name().to_string_lossy())); + } + } + tags.sort(); + Ok(tags) + } + fn commit_tags(&self, commit_message: &str) -> Result<(), IssueError> { let mut tags_filename = self.dir.clone(); tags_filename.push("tags"); From 485f88c686f78aabb465d9f84168f477b1c50555 Mon Sep 17 00:00:00 2001 From: Sebastian Kuzminsky Date: Sun, 20 Jul 2025 12:53:44 -0600 Subject: [PATCH 10/15] add a tool to migrate tags from files to dirs --- tools/update-tags-encoding | 71 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 tools/update-tags-encoding diff --git a/tools/update-tags-encoding b/tools/update-tags-encoding new file mode 100755 index 0000000..c06ba74 --- /dev/null +++ b/tools/update-tags-encoding @@ -0,0 +1,71 @@ +#!/bin/bash +# +# Check out the `entomologist-data` branch in a temporary worktree. +# For each issue with a `tags` file, replace the old-style tags file with a new-style tags dir. +# git commit + +set -e +#set -x + +BRANCH="" + +if [[ -n "$1" ]] && [[ -d "$1" ]]; then + echo "updating ent db in directory '$1'" + pushd "$1" +else + if [[ -n "$1" ]]; then + # better be a branch + BRANCH="$1" + else + BRANCH="entomologist-data" + fi + echo "updating ent db in branch '${BRANCH}'" + WORKTREE_DIR=$(mktemp --directory) + git worktree add "${WORKTREE_DIR}" "${BRANCH}" + pushd "${WORKTREE_DIR}" > /dev/null +fi + +# Now our current working directory is the ent db that we're supposed +# to update. +# +# If $BRANCH is empty, we're in a directory not tracked by git and we +# just change the files. +# +# If $BRANCH is not empty, we're in a git worktree of the branch we're +# supposed to change, so we commit as we go. + +for ISSUE_ID in $(find . -maxdepth 1 -type d -regextype posix-extended -regex '\./[0-9a-f]{32}'); do + ISSUE_ID=$(basename "${ISSUE_ID}") + if ! [[ -f "${ISSUE_ID}/tags" ]]; then + continue + fi + + pushd "${ISSUE_ID}" > /dev/null + + echo "${ISSUE_ID} has tags:" + TAGS=$(cat tags) + echo "${TAGS}" + rm tags + + if [[ -n "${BRANCH}" ]]; then + git rm -f tags + fi + + mkdir tags + for TAG in ${TAGS}; do + touch "tags/${TAG}" + done + + if [[ -n "${BRANCH}" ]]; then + git add tags + git commit -m "issue ${ISSUE_ID}: update tags to new format" + fi + + popd > /dev/null +done + +popd > /dev/null + +if [[ -n "${BRANCH}" ]]; then + git worktree remove "${WORKTREE_DIR}" +fi From 99d19e0fd99a75041340697cc39cc51b2922a712 Mon Sep 17 00:00:00 2001 From: Sebastian Kuzminsky Date: Wed, 23 Jul 2025 15:14:13 -0600 Subject: [PATCH 11/15] update test/0000 tags --- test/0000/3943fc5c173fdf41c0a22251593cd476/tags | 3 --- test/0000/3943fc5c173fdf41c0a22251593cd476/tags/TAG2 | 0 .../0000/3943fc5c173fdf41c0a22251593cd476/tags/i-am-also-a-tag | 0 test/0000/3943fc5c173fdf41c0a22251593cd476/tags/tag1 | 0 4 files changed, 3 deletions(-) delete mode 100644 test/0000/3943fc5c173fdf41c0a22251593cd476/tags create mode 100644 test/0000/3943fc5c173fdf41c0a22251593cd476/tags/TAG2 create mode 100644 test/0000/3943fc5c173fdf41c0a22251593cd476/tags/i-am-also-a-tag create mode 100644 test/0000/3943fc5c173fdf41c0a22251593cd476/tags/tag1 diff --git a/test/0000/3943fc5c173fdf41c0a22251593cd476/tags b/test/0000/3943fc5c173fdf41c0a22251593cd476/tags deleted file mode 100644 index 04e82a6..0000000 --- a/test/0000/3943fc5c173fdf41c0a22251593cd476/tags +++ /dev/null @@ -1,3 +0,0 @@ -tag1 -TAG2 -i-am-also-a-tag diff --git a/test/0000/3943fc5c173fdf41c0a22251593cd476/tags/TAG2 b/test/0000/3943fc5c173fdf41c0a22251593cd476/tags/TAG2 new file mode 100644 index 0000000..e69de29 diff --git a/test/0000/3943fc5c173fdf41c0a22251593cd476/tags/i-am-also-a-tag b/test/0000/3943fc5c173fdf41c0a22251593cd476/tags/i-am-also-a-tag new file mode 100644 index 0000000..e69de29 diff --git a/test/0000/3943fc5c173fdf41c0a22251593cd476/tags/tag1 b/test/0000/3943fc5c173fdf41c0a22251593cd476/tags/tag1 new file mode 100644 index 0000000..e69de29 From bc72061d149f94b7e900ba243ded31fe331b72ca Mon Sep 17 00:00:00 2001 From: Sebastian Kuzminsky Date: Wed, 23 Jul 2025 20:23:03 -0600 Subject: [PATCH 12/15] refactor Issue::read_tags() to handle escaping --- src/issue.rs | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 102 insertions(+), 1 deletion(-) diff --git a/src/issue.rs b/src/issue.rs index 81559f4..6a7abe9 100644 --- a/src/issue.rs +++ b/src/issue.rs @@ -48,6 +48,10 @@ pub enum IssueError { ChronoParseError(#[from] chrono::format::ParseError), #[error("Failed to parse issue")] IssueParseError, + #[error("invalid escape character {escape:?} in tag file {filename:?}")] + TagInvalidEscape { escape: String, filename: String }, + #[error("invalid trailing escape character ',' in tag file {filename:?}")] + TagTrailingEscape { filename: String }, #[error("Failed to parse state")] StateParseError, #[error("Failed to run git")] @@ -527,13 +531,52 @@ impl Issue { let mut tags = Vec::::new(); for direntry in tags_direntry.path().read_dir()? { if let Ok(direntry) = direntry { - tags.push(String::from(direntry.file_name().to_string_lossy())); + let tag = Issue::tag_from_filename(&direntry.file_name().to_string_lossy())?; + tags.push(tag); } } tags.sort(); Ok(tags) } + /// Perform un-escape on a filename to make it into a tag: + /// ",0" => "," + /// ",1" => "/" + fn tag_from_filename(filename: &str) -> Result { + let mut tag = String::new(); + let mut token_iter = filename.split(','); + let Some(start) = token_iter.next() else { + return Err(IssueError::StdIoError(std::io::Error::from( + std::io::ErrorKind::NotFound, + ))); + }; + tag.push_str(start); + for token in token_iter { + match token.chars().nth(0) { + Some('0') => { + tag.push(','); + tag.push_str(&token[1..]); + } + Some('1') => { + tag.push('/'); + tag.push_str(&token[1..]); + } + Some(bogus) => { + return Err(IssueError::TagInvalidEscape { + escape: String::from(bogus), + filename: String::from(filename), + }); + } + None => { + return Err(IssueError::TagTrailingEscape { + filename: String::from(filename), + }); + } + } + } + Ok(tag) + } + fn commit_tags(&self, commit_message: &str) -> Result<(), IssueError> { let mut tags_filename = self.dir.clone(); tags_filename.push("tags"); @@ -560,6 +603,64 @@ mod tests { use super::*; use pretty_assertions::assert_eq; + #[test] + fn parse_tag_0() { + assert_eq!( + Issue::tag_from_filename("hello").unwrap(), + String::from("hello") + ); + } + + #[test] + fn parse_tag_1() { + assert_eq!( + Issue::tag_from_filename("hello,0world").unwrap(), + String::from("hello,world") + ); + } + + #[test] + fn parse_tag_2() { + assert_eq!( + Issue::tag_from_filename("hello,1world").unwrap(), + String::from("hello/world") + ); + } + + #[test] + fn parse_tag_3() { + assert_eq!( + Issue::tag_from_filename(",0hello,1world,0").unwrap(), + String::from(",hello/world,") + ); + } + + #[test] + fn parse_tag_4() { + // std::io::Error does not impl PartialEq :-( + let filename = "hello,"; + match Issue::tag_from_filename(filename) { + Ok(tag) => panic!( + "tag_from_filename() accepted invalid input {:?} and returned {:?}", + filename, tag + ), + Err(_e) => (), + } + } + + #[test] + fn parse_tag_5() { + // std::io::Error does not impl PartialEq :-( + let filename = "hello,world"; + match Issue::tag_from_filename(filename) { + Ok(tag) => panic!( + "tag_from_filename() accepted invalid input {:?} and returned {:?}", + filename, tag + ), + Err(_e) => (), + } + } + #[test] fn read_issue_0() { let issue_dir = std::path::Path::new("test/0000/3943fc5c173fdf41c0a22251593cd476/"); From 9b941fdbdae40187f2f40d05bbf8fd39b516486d Mon Sep 17 00:00:00 2001 From: Sebastian Kuzminsky Date: Wed, 23 Jul 2025 20:24:42 -0600 Subject: [PATCH 13/15] add some tags with escapes to the tests --- src/issue.rs | 5 +++++ src/issues.rs | 5 +++++ test/0000/3943fc5c173fdf41c0a22251593cd476/tags/bird,1wing | 0 .../tags/bird,1wing,1feather | 0 test/0000/3943fc5c173fdf41c0a22251593cd476/tags/deer,0antler | 0 .../tags/deer,0antler,0tassle | 0 .../3943fc5c173fdf41c0a22251593cd476/tags/hop,0scotch,1shoe | 0 7 files changed, 10 insertions(+) create mode 100644 test/0000/3943fc5c173fdf41c0a22251593cd476/tags/bird,1wing create mode 100644 test/0000/3943fc5c173fdf41c0a22251593cd476/tags/bird,1wing,1feather create mode 100644 test/0000/3943fc5c173fdf41c0a22251593cd476/tags/deer,0antler create mode 100644 test/0000/3943fc5c173fdf41c0a22251593cd476/tags/deer,0antler,0tassle create mode 100644 test/0000/3943fc5c173fdf41c0a22251593cd476/tags/hop,0scotch,1shoe diff --git a/src/issue.rs b/src/issue.rs index 6a7abe9..fb05cb6 100644 --- a/src/issue.rs +++ b/src/issue.rs @@ -674,6 +674,11 @@ mod tests { done_time: None, tags: Vec::::from([ String::from("TAG2"), + String::from("bird/wing"), + String::from("bird/wing/feather"), + String::from("deer,antler"), + String::from("deer,antler,tassle"), + String::from("hop,scotch/shoe"), String::from("i-am-also-a-tag"), String::from("tag1"), ]), diff --git a/src/issues.rs b/src/issues.rs index d3c57c0..49d721d 100644 --- a/src/issues.rs +++ b/src/issues.rs @@ -128,6 +128,11 @@ mod tests { done_time: None, tags: Vec::::from([ String::from("TAG2"), + String::from("bird/wing"), + String::from("bird/wing/feather"), + String::from("deer,antler"), + String::from("deer,antler,tassle"), + String::from("hop,scotch/shoe"), String::from("i-am-also-a-tag"), String::from("tag1"), ]), diff --git a/test/0000/3943fc5c173fdf41c0a22251593cd476/tags/bird,1wing b/test/0000/3943fc5c173fdf41c0a22251593cd476/tags/bird,1wing new file mode 100644 index 0000000..e69de29 diff --git a/test/0000/3943fc5c173fdf41c0a22251593cd476/tags/bird,1wing,1feather b/test/0000/3943fc5c173fdf41c0a22251593cd476/tags/bird,1wing,1feather new file mode 100644 index 0000000..e69de29 diff --git a/test/0000/3943fc5c173fdf41c0a22251593cd476/tags/deer,0antler b/test/0000/3943fc5c173fdf41c0a22251593cd476/tags/deer,0antler new file mode 100644 index 0000000..e69de29 diff --git a/test/0000/3943fc5c173fdf41c0a22251593cd476/tags/deer,0antler,0tassle b/test/0000/3943fc5c173fdf41c0a22251593cd476/tags/deer,0antler,0tassle new file mode 100644 index 0000000..e69de29 diff --git a/test/0000/3943fc5c173fdf41c0a22251593cd476/tags/hop,0scotch,1shoe b/test/0000/3943fc5c173fdf41c0a22251593cd476/tags/hop,0scotch,1shoe new file mode 100644 index 0000000..e69de29 From 87f6b42595e7d80190b91b07bfaa31c7ccefe0b4 Mon Sep 17 00:00:00 2001 From: Sebastian Kuzminsky Date: Thu, 24 Jul 2025 12:33:57 -0600 Subject: [PATCH 14/15] Issue::commit_tags(): write new-style escaped tags --- src/issue.rs | 60 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 4 deletions(-) diff --git a/src/issue.rs b/src/issue.rs index fb05cb6..093d2e4 100644 --- a/src/issue.rs +++ b/src/issue.rs @@ -577,12 +577,28 @@ impl Issue { Ok(tag) } + // Perform escape on a tag to make it into a filename: + // "," => ",0" + // "/" => ",1" + fn tag_to_filename(tag: &str) -> String { + let mut filename = tag.replace(",", ",0"); + filename = filename.replace("/", ",1"); + return filename; + } + fn commit_tags(&self, commit_message: &str) -> Result<(), IssueError> { - let mut tags_filename = self.dir.clone(); - tags_filename.push("tags"); - let mut tags_file = std::fs::File::create(&tags_filename)?; + let mut tags_dir_name = self.dir.clone(); + tags_dir_name.push("tags"); + match std::fs::remove_dir_all(&tags_dir_name) { + Err(e) if e.kind() == std::io::ErrorKind::NotFound => (), + Err(e) => return Err(e.into()), + Ok(_) => (), + } + std::fs::create_dir(&tags_dir_name)?; for tag in &self.tags { - writeln!(tags_file, "{}", tag)?; + let mut tag_filename = tags_dir_name.clone(); + tag_filename.push(Issue::tag_to_filename(tag)); + std::fs::File::create(&tag_filename)?; } self.commit(commit_message)?; Ok(()) @@ -661,6 +677,42 @@ mod tests { } } + #[test] + fn tag_to_filename_0() { + let tag = "hello"; + assert_eq!(Issue::tag_to_filename(tag), "hello"); + } + + #[test] + fn tag_to_filename_1() { + let tag = "hello,"; + assert_eq!(Issue::tag_to_filename(tag), "hello,0"); + } + + #[test] + fn tag_to_filename_2() { + let tag = "/hello"; + assert_eq!(Issue::tag_to_filename(tag), ",1hello"); + } + + #[test] + fn tag_to_filename_3() { + let tag = "hello/bye,boo"; + assert_eq!(Issue::tag_to_filename(tag), "hello,1bye,0boo"); + } + + #[test] + fn tag_to_filename_4() { + let tag = ",,,///,,,"; + assert_eq!(Issue::tag_to_filename(tag), ",0,0,0,1,1,1,0,0,0"); + } + + #[test] + fn tag_to_filename_5() { + let tag = ",0,0,1,1"; + assert_eq!(Issue::tag_to_filename(tag), ",00,00,01,01"); + } + #[test] fn read_issue_0() { let issue_dir = std::path::Path::new("test/0000/3943fc5c173fdf41c0a22251593cd476/"); From bedcc8a352c4ff971724e0ce9b061848ccfee5f0 Mon Sep 17 00:00:00 2001 From: Sebastian Kuzminsky Date: Thu, 24 Jul 2025 12:09:22 -0600 Subject: [PATCH 15/15] update-tags-encoding: escape '/' and ',' in tags --- tools/update-tags-encoding | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/update-tags-encoding b/tools/update-tags-encoding index c06ba74..9ab10a0 100755 --- a/tools/update-tags-encoding +++ b/tools/update-tags-encoding @@ -7,6 +7,13 @@ set -e #set -x +function escape_tag() { + TAG="$1" + TAG=$(echo "${TAG}" | sed -re 's/,/,0/g') + TAG=$(echo "${TAG}" | sed -re 's/\//,1/g') + echo "${TAG}" +} + BRANCH="" if [[ -n "$1" ]] && [[ -d "$1" ]]; then @@ -53,6 +60,7 @@ for ISSUE_ID in $(find . -maxdepth 1 -type d -regextype posix-extended -regex '\ mkdir tags for TAG in ${TAGS}; do + TAG=$(escape_tag "${TAG}") touch "tags/${TAG}" done