Skip to content

Commit bd281b8

Browse files
committed
adapt to changes in git-discover (#301)
1 parent 050f795 commit bd281b8

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

git-repository/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ impl From<git_discover::repository::Kind> for Kind {
219219
fn from(v: git_discover::repository::Kind) -> Self {
220220
match v {
221221
git_discover::repository::Kind::Bare => Kind::Bare,
222+
git_discover::repository::Kind::WorkTreeGitDir { .. } => Kind::WorkTree { is_linked: true },
222223
git_discover::repository::Kind::WorkTree { linked_git_dir } => Kind::WorkTree {
223224
is_linked: linked_git_dir.is_some(),
224225
},

git-repository/src/worktree/proxy.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,14 @@ impl<'repo> Proxy<'repo> {
3434
/// Note that the location might not exist.
3535
pub fn base(&self) -> std::io::Result<PathBuf> {
3636
let git_dir = self.git_dir.join("gitdir");
37-
let mut base_dot_git = git_discover::path::from_plain_file(&git_dir).ok_or_else(|| {
37+
let base_dot_git = git_discover::path::from_plain_file(&git_dir).ok_or_else(|| {
3838
std::io::Error::new(
3939
std::io::ErrorKind::NotFound,
4040
format!("Required file '{}' does not exist", git_dir.display()),
4141
)
4242
})??;
43-
if base_dot_git.file_name().and_then(|n| n.to_str()) == Some(".git") {
44-
base_dot_git.pop();
45-
}
46-
Ok(base_dot_git)
43+
44+
Ok(git_discover::path::without_dot_git_dir(base_dot_git))
4745
}
4846

4947
/// The git directory for the work tree, typically contained within the parent git dir.

0 commit comments

Comments
 (0)