From e47e537b0716ede45e741d0b726621c120472e4a Mon Sep 17 00:00:00 2001 From: Fatih Acet Date: Tue, 2 Aug 2016 23:27:37 +0300 Subject: [PATCH] Handle renamed files in file header. --- .../javascripts/merge_conflict_data_provider.js.es6 | 8 ++++++++ app/views/projects/merge_requests/conflicts.html.haml | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/merge_conflict_data_provider.js.es6 b/app/assets/javascripts/merge_conflict_data_provider.js.es6 index c0a3ecc6df3..2b84d9b694d 100644 --- a/app/assets/javascripts/merge_conflict_data_provider.js.es6 +++ b/app/assets/javascripts/merge_conflict_data_provider.js.es6 @@ -52,6 +52,7 @@ window.MergeConflictDataProvider = class MergeConflictDataProvider { setParallelLines(data) { data.files.forEach( (file) => { + file.filePath = this.getFilePath(file); file.parallelLines = { left: [], right: [] }; file.sections.forEach( (section) => { @@ -110,6 +111,7 @@ window.MergeConflictDataProvider = class MergeConflictDataProvider { setInlineLines(data) { data.files.forEach( (file) => { file.inlineLines = [] + file.filePath = this.getFilePath(file); file.sections.forEach( (section) => { let currentLineType = 'new'; @@ -292,4 +294,10 @@ window.MergeConflictDataProvider = class MergeConflictDataProvider { } } + + getFilePath(file) { + const { old_path, new_path } = file; + return old_path === new_path ? new_path : `${old_path} → ${new_path}`; + } + } diff --git a/app/views/projects/merge_requests/conflicts.html.haml b/app/views/projects/merge_requests/conflicts.html.haml index 129b4c04a25..b2531fc5073 100644 --- a/app/views/projects/merge_requests/conflicts.html.haml +++ b/app/views/projects/merge_requests/conflicts.html.haml @@ -39,7 +39,7 @@ .files{"v-if" => "isParallel"} .diff-file.file-holder.conflict.parallel-view{"v-for" => "file in conflictsData.files"} .file-title - %span {{file.new_path}} + %span {{{file.filePath}}} .file-actions %a.btn.btn-sm View file @{{conflictsData.shortCommitSha}} @@ -66,10 +66,11 @@ %td.line_content {{{line.richText}}} + .files{"v-if" => "!isParallel"} .diff-file.file-holder.conflict.inline-view{"v-for" => "file in conflictsData.files"} .file-title - %span {{file.new_path}} + %span {{{file.filePath}}} .file-actions %a.btn.btn-sm View file @{{conflictsData.shortCommitSha}}