diff options
author | Yar <YarTheGreat@gmail.com> | 2016-11-13 21:18:03 +0300 |
---|---|---|
committer | YarNayar <YarTheGreat@gmail.com> | 2016-11-15 20:51:21 +0300 |
commit | 8782bb96cca3ade2b367f588fd8332906dcc2d1b (patch) | |
tree | 9f46f21807532db46d72cd5f4936d088368f5fd7 /app/views/projects/diffs/_diffs.html.haml | |
parent | 5b876592b47209e431d37b281aacb187df870ea3 (diff) |
Unify anchor link format for MR diff files !7298
Right now, the following naming scheme for diff files is used: diff-1, diff-2, ... and also we have "internal" format which is file-path-HASH, where HASH is sha1 of file path.
Besides, we have HASH_lineA_lineB format to link exact line number in MR diff. It makes sence to unify the way we link diff from outside, while leave "file-path-HASH" format for internal (js) usage.
Changes in this commit allow to link diff just by HASH, if we don't want specify exact lines, also it changes "file-path-HASH" and "diff-NUMBER" links in code to this unified format.
Inspired by #24010 and !7298
Diffstat (limited to 'app/views/projects/diffs/_diffs.html.haml')
-rw-r--r-- | app/views/projects/diffs/_diffs.html.haml | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/views/projects/diffs/_diffs.html.haml b/app/views/projects/diffs/_diffs.html.haml index 067cf595da3..ab4a2dc36e5 100644 --- a/app/views/projects/diffs/_diffs.html.haml +++ b/app/views/projects/diffs/_diffs.html.haml @@ -22,11 +22,12 @@ = render 'projects/diffs/warning', diff_files: diff_files .files{ data: { can_create_note: can_create_note } } - - diff_files.each_with_index do |diff_file, index| + - diff_files.each_with_index do |diff_file| - diff_commit = commit_for_diff(diff_file) - blob = diff_file.blob(diff_commit) - next unless blob - blob.load_all_data!(diffs.project.repository) unless blob.only_display_raw? + - file_hash = hexdigest(diff_file.file_path) - = render 'projects/diffs/file', index: index, project: diffs.project, + = render 'projects/diffs/file', file_hash: file_hash, project: diffs.project, diff_file: diff_file, diff_commit: diff_commit, blob: blob |