Skip to content

Commit

Permalink
Merge pull request #4357 from tomhughes/blame-realpath
Browse files Browse the repository at this point in the history
Resolve paths when blaming files
  • Loading branch information
bruntib authored Nov 29, 2024
2 parents 53655b1 + 97abac1 commit a3ede93
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions web/client/codechecker_client/blame_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ def __get_tracking_branch(repo: Repo) -> Optional[str]:
def __get_blame_info(file_path: str):
""" Get blame info for the given file. """
try:
repo = Repo(file_path, search_parent_directories=True)
if repo.ignored(file_path):
real_path = os.path.realpath(file_path)
repo = Repo(real_path, search_parent_directories=True)
if repo.ignored(real_path):
LOG.debug("File %s is an ignored file", file_path)
return None
except InvalidGitRepositoryError:
Expand All @@ -59,7 +60,7 @@ def __get_blame_info(file_path: str):
pass

try:
blame = repo.blame_incremental(repo.head.commit.hexsha, file_path)
blame = repo.blame_incremental(repo.head.commit.hexsha, real_path)

res = {
'version': 'v1',
Expand Down

0 comments on commit a3ede93

Please sign in to comment.