Skip to content

Commit 3bd08d9

Browse files
committed
Move helper functions to the bottom for consistency; fix name
1 parent 2aaebcb commit 3bd08d9

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

tests/testsuite/git_shallow.rs

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -508,45 +508,6 @@ fn gitoxide_clones_registry_with_shallow_protocol_and_follow_up_fetch_maintains_
508508
Ok(())
509509
}
510510

511-
fn find_lexicographically_first_bar_checkout() -> std::path::PathBuf {
512-
glob::glob(
513-
paths::home()
514-
.join(".cargo/git/checkouts/bar-*/*/.git")
515-
.to_str()
516-
.unwrap(),
517-
)
518-
.unwrap()
519-
.next()
520-
.unwrap()
521-
.unwrap()
522-
.to_owned()
523-
}
524-
525-
fn find_remote_index(mode: RepoMode) -> std::path::PathBuf {
526-
glob::glob(
527-
paths::home()
528-
.join(".cargo/registry/index/*")
529-
.to_str()
530-
.unwrap(),
531-
)
532-
.unwrap()
533-
.map(Result::unwrap)
534-
.filter(|p| p.to_string_lossy().ends_with("-shallow") == matches!(mode, RepoMode::Shallow))
535-
.next()
536-
.unwrap()
537-
}
538-
539-
/// Find a checkout directory for bar, `shallow` or not.
540-
fn find_bar_db(mode: RepoMode) -> std::path::PathBuf {
541-
glob::glob(paths::home().join(".cargo/git/db/bar-*").to_str().unwrap())
542-
.unwrap()
543-
.map(Result::unwrap)
544-
.filter(|p| p.to_string_lossy().ends_with("-shallow") == matches!(mode, RepoMode::Shallow))
545-
.next()
546-
.unwrap()
547-
.to_owned()
548-
}
549-
550511
/// If there is shallow *and* non-shallow clones, non-shallow will naturally be returned due to sort order.
551512
#[cargo_test]
552513
fn gitoxide_clones_registry_without_shallow_protocol_and_follow_up_fetch_uses_shallowness(
@@ -638,7 +599,7 @@ fn gitoxide_clones_registry_without_shallow_protocol_and_follow_up_fetch_uses_sh
638599
}
639600

640601
#[cargo_test]
641-
fn gitoxide_unshallows_git_dependencies_that_may_not_be_shallow_anymore() -> anyhow::Result<()> {
602+
fn gitoxide_git_dependencies_switch_from_branch_to_rev() -> anyhow::Result<()> {
642603
// db exists from previous build, then dependency changes to refer to revision that isn't
643604
// available in the shallow clone.
644605

@@ -829,3 +790,42 @@ fn gitoxide_clones_registry_with_shallow_protocol_and_aborts_and_updates_again(
829790

830791
Ok(())
831792
}
793+
794+
fn find_lexicographically_first_bar_checkout() -> std::path::PathBuf {
795+
glob::glob(
796+
paths::home()
797+
.join(".cargo/git/checkouts/bar-*/*/.git")
798+
.to_str()
799+
.unwrap(),
800+
)
801+
.unwrap()
802+
.next()
803+
.unwrap()
804+
.unwrap()
805+
.to_owned()
806+
}
807+
808+
fn find_remote_index(mode: RepoMode) -> std::path::PathBuf {
809+
glob::glob(
810+
paths::home()
811+
.join(".cargo/registry/index/*")
812+
.to_str()
813+
.unwrap(),
814+
)
815+
.unwrap()
816+
.map(Result::unwrap)
817+
.filter(|p| p.to_string_lossy().ends_with("-shallow") == matches!(mode, RepoMode::Shallow))
818+
.next()
819+
.unwrap()
820+
}
821+
822+
/// Find a checkout directory for bar, `shallow` or not.
823+
fn find_bar_db(mode: RepoMode) -> std::path::PathBuf {
824+
glob::glob(paths::home().join(".cargo/git/db/bar-*").to_str().unwrap())
825+
.unwrap()
826+
.map(Result::unwrap)
827+
.filter(|p| p.to_string_lossy().ends_with("-shallow") == matches!(mode, RepoMode::Shallow))
828+
.next()
829+
.unwrap()
830+
.to_owned()
831+
}

0 commit comments

Comments
 (0)