🏡 index : ~doyle/chartered.git

author Jordan Doyle <jordan@doyle.la> 2022-09-17 2:42:43.0 +01:00:00
committer Jordan Doyle <jordan@doyle.la> 2022-09-17 2:42:43.0 +01:00:00
commit
77d1a49605cf78248fb555aef6cec5fcbd549016 [patch]
tree
5ec310a1fc0e153a2bcb0f39f17fe04313804012
parent
b7b74dd9f366d4253db7c6d505724807a9b36ded
download
77d1a49605cf78248fb555aef6cec5fcbd549016.tar.gz

Backport 3-character crate name fix from gitlab-cargo-shim



Diff

 chartered-git/src/tree.rs | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/chartered-git/src/tree.rs b/chartered-git/src/tree.rs
index e227c9e..ac3a223 100644
--- a/chartered-git/src/tree.rs
+++ a/chartered-git/src/tree.rs
@@ -81,7 +81,10 @@
        0 => {}
        1 => folders.push("1"),
        2 => folders.push("2"),
        3 => folders.push("3"),
        3 => {
            folders.push("3");
            folders.push(&crate_name[..1]);
        }
        _ => {
            folders.push(&crate_name[..2]);
            folders.push(&crate_name[2..4]);
@@ -112,7 +115,7 @@
        let folder = super::get_crate_folder("abc");
        let mut folder = folder.iter();
        assert_eq!(folder.next(), Some(&"3"));
        assert_eq!(folder.next(), None);
        assert_eq!(folder.next(), Some(&"a"));

        let folder = super::get_crate_folder("abcd");
        let mut folder = folder.iter();