Fix git blame not working correctly with submodules (#10114)
This fixes #9958 by using the correct working directory in which to run `git blame`. This wasn't an issue for a single repository, because we could go from `.git` one directory up, but it doesn't work for submodules. Luckily there's a `workdir()` method on `self.repository` that does exactly what we need. In submodule:  Not in submodule:  Release Notes: - N/A
This commit is contained in:
parent
58aec1de75
commit
c4ceeb715a
1 changed files with 4 additions and 4 deletions
|
@ -232,10 +232,10 @@ impl GitRepository for RealGitRepository {
|
|||
}
|
||||
|
||||
fn blame(&self, path: &Path, content: Rope) -> Result<git::blame::Blame> {
|
||||
let git_dir_path = self.repository.path();
|
||||
let working_directory = git_dir_path.parent().with_context(|| {
|
||||
format!("failed to get git working directory for {:?}", git_dir_path)
|
||||
})?;
|
||||
let working_directory = self
|
||||
.repository
|
||||
.workdir()
|
||||
.with_context(|| format!("failed to get git working directory for file {:?}", path))?;
|
||||
|
||||
const REMOTE_NAME: &str = "origin";
|
||||
let remote_url = self.remote_url(REMOTE_NAME);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue