Skip to content

Commit 500175f

Browse files
committed
fix: make finding bare repos with an index possible with ein t find.
1 parent 0737d97 commit 500175f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

gitoxide-core/src/organize.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ fn find_git_repository_workdirs(
3636
Some(gix::repository::Kind::WorkTree { is_linked: true })
3737
}
3838
}
39-
fn into_workdir(git_dir: PathBuf) -> PathBuf {
40-
if gix::discover::is_bare(&git_dir) {
39+
fn into_workdir(git_dir: PathBuf, kind: &gix::repository::Kind) -> PathBuf {
40+
if matches!(kind, gix::repository::Kind::Bare) || gix::discover::is_bare(&git_dir) {
4141
git_dir
4242
} else {
4343
git_dir.parent().expect("git is never in the root").to_owned()
@@ -81,7 +81,12 @@ fn find_git_repository_workdirs(
8181
.into_iter()
8282
.inspect(move |_| progress.inc())
8383
.filter_map(Result::ok)
84-
.filter_map(|mut e| e.client_state.kind.take().map(|kind| (into_workdir(e.path()), kind)))
84+
.filter_map(|mut e| {
85+
e.client_state
86+
.kind
87+
.take()
88+
.map(|kind| (into_workdir(e.path(), &kind), kind))
89+
})
8590
}
8691

8792
fn find_origin_remote(repo: &Path) -> anyhow::Result<Option<gix_url::Url>> {

0 commit comments

Comments
 (0)