Fix permalink-to-line when Git repo root and worktree dir don't coincide (#22003)

Closes #21505. This should work if the git dir is an ancestor of the
worktree dir or vice versa.

Release Notes:

- Fixed GitHub permalink-to-line actions when worktree dir and Git dir
aren't the same
This commit is contained in:
Cole Miller 2024-12-19 14:23:50 -05:00 committed by GitHub
parent 1e2fa3b022
commit 2094d50514
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 91 additions and 8 deletions

View file

@ -2396,7 +2396,6 @@ impl Snapshot {
.map(|(path, entry)| (&path.0, entry))
}
/// Get the repository whose work directory contains the given path.
pub fn repository_for_work_directory(&self, path: &Path) -> Option<RepositoryEntry> {
self.repository_entries
.get(&RepositoryWorkDirectory(path.into()))