Skip to content

Commit

Permalink
adapt to changes in git-discover (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed May 18, 2022
1 parent 050f795 commit bd281b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions git-repository/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ impl From<git_discover::repository::Kind> for Kind {
fn from(v: git_discover::repository::Kind) -> Self {
match v {
git_discover::repository::Kind::Bare => Kind::Bare,
git_discover::repository::Kind::WorkTreeGitDir { .. } => Kind::WorkTree { is_linked: true },
git_discover::repository::Kind::WorkTree { linked_git_dir } => Kind::WorkTree {
is_linked: linked_git_dir.is_some(),
},
Expand Down
8 changes: 3 additions & 5 deletions git-repository/src/worktree/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,14 @@ impl<'repo> Proxy<'repo> {
/// Note that the location might not exist.
pub fn base(&self) -> std::io::Result<PathBuf> {
let git_dir = self.git_dir.join("gitdir");
let mut base_dot_git = git_discover::path::from_plain_file(&git_dir).ok_or_else(|| {
let base_dot_git = git_discover::path::from_plain_file(&git_dir).ok_or_else(|| {
std::io::Error::new(
std::io::ErrorKind::NotFound,
format!("Required file '{}' does not exist", git_dir.display()),
)
})??;
if base_dot_git.file_name().and_then(|n| n.to_str()) == Some(".git") {
base_dot_git.pop();
}
Ok(base_dot_git)

Ok(git_discover::path::without_dot_git_dir(base_dot_git))
}

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

0 comments on commit bd281b8

Please sign in to comment.