From 77d1a49605cf78248fb555aef6cec5fcbd549016 Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Sat, 17 Sep 2022 02:42:43 +0100 Subject: [PATCH] Backport 3-character crate name fix from gitlab-cargo-shim --- 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(); -- rgit 0.1.3