Skip to content

Commit 0bbf351

Browse files
authored
Merge pull request #4594 from gulyasgergely902/cc_diff_incorrect_gerrit_json_output
[feat] Check if file path is absolute or not in gerrit py.
2 parents 2da89a3 + 22ff008 commit 0bbf351

File tree

1 file changed

+6
-2
lines changed
  • tools/report-converter/codechecker_report_converter/report/output

1 file changed

+6
-2
lines changed

tools/report-converter/codechecker_report_converter/report/output/gerrit.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,12 @@ def __convert_reports(reports: List[Report],
8585
report_count += 1
8686

8787
# file_name can be without a path in the report.
88-
rel_file_path = os.path.relpath(file_name, repo_dir) \
89-
if repo_dir and os.path.dirname(file_name) != "" else file_name
88+
if repo_dir \
89+
and os.path.dirname(file_name) != "" \
90+
and os.path.isabs(file_name):
91+
rel_file_path = os.path.relpath(file_name, repo_dir)
92+
else:
93+
rel_file_path = file_name
9094

9195
checked_file = rel_file_path \
9296
+ ':' + str(report.line) + ":" + str(report.column)

0 commit comments

Comments
 (0)