File tree Expand file tree Collapse file tree 3 files changed +10
-14
lines changed Expand file tree Collapse file tree 3 files changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -42,13 +42,19 @@ type RequestWithPosition interface {
4242func buildCommentPosition (commentWithPositionData RequestWithPosition ) * gitlab.PositionOptions {
4343 positionData := commentWithPositionData .GetPositionData ()
4444
45+ // If the file has been renamed, then this is a relevant part of the payload
46+ oldFileName := positionData .OldFileName
47+ if oldFileName == "" {
48+ oldFileName = positionData .FileName
49+ }
50+
4551 opt := & gitlab.PositionOptions {
4652 PositionType : & positionData .Type ,
4753 StartSHA : & positionData .StartCommitSHA ,
4854 HeadSHA : & positionData .HeadCommitSHA ,
4955 BaseSHA : & positionData .BaseCommitSHA ,
5056 NewPath : & positionData .FileName ,
51- OldPath : & positionData . OldFileName ,
57+ OldPath : & oldFileName ,
5258 NewLine : positionData .NewLine ,
5359 OldLine : positionData .OldLine ,
5460 }
Original file line number Diff line number Diff line change @@ -153,9 +153,9 @@ M.create_comment_layout = function(opts)
153153 title = " Note"
154154 user_settings = popup_settings .note
155155 else
156- -- TODO: investigate why ` old_file_name` is in fact the new name for renamed files!
157- local file_name = M . location . reviewer_data . old_file_name ~= " " and M .location .reviewer_data .old_file_name
158- or M .location .reviewer_data .file_name
156+ local file_name = ( M . location . reviewer_data . new_sha_focused or M . location . reviewer_data . old_file_name == " " )
157+ and M .location .reviewer_data .file_name
158+ or M .location .reviewer_data .old_file_name
159159 title =
160160 popup .create_title (" Comment" , file_name , M .location .visual_range .start_line , M .location .visual_range .end_line )
161161 user_settings = popup_settings .comment
Original file line number Diff line number Diff line change @@ -196,18 +196,8 @@ M.get_reviewer_data = function(current_win)
196196 local opposite_bufnr = new_sha_focused and layout .a .file .bufnr or layout .b .file .bufnr
197197
198198 return {
199- <<<<<<< HEAD
200199 old_file_name = M .is_file_renamed () and layout .a .file .path or " " ,
201200 file_name = layout .b .file .path ,
202- ||||||| parent of f57cc84 (Fix : Store reviewer data before creating comment popup (# 476 ))
203- old_file_name = layout .a .file .path ,
204- file_name = layout .b .file .path ,
205- =======
206- -- TODO: swap 'a' and 'b' to fix lua/gitlab/actions/comment.lua:158, and hopefully also
207- -- lua/gitlab/indicators/diagnostics.lua:129.
208- file_name = layout .a .file .path ,
209- old_file_name = M .is_file_renamed () and layout .b .file .path or " " ,
210- >>>>>>> f57cc84 (Fix : Store reviewer data before creating comment popup (# 476 ))
211201 old_line_from_buf = old_line ,
212202 new_line_from_buf = new_line ,
213203 modification_type = modification_type ,
You can’t perform that action at this time.
0 commit comments