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 {
42
42
func buildCommentPosition (commentWithPositionData RequestWithPosition ) * gitlab.PositionOptions {
43
43
positionData := commentWithPositionData .GetPositionData ()
44
44
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
+
45
51
opt := & gitlab.PositionOptions {
46
52
PositionType : & positionData .Type ,
47
53
StartSHA : & positionData .StartCommitSHA ,
48
54
HeadSHA : & positionData .HeadCommitSHA ,
49
55
BaseSHA : & positionData .BaseCommitSHA ,
50
56
NewPath : & positionData .FileName ,
51
- OldPath : & positionData . OldFileName ,
57
+ OldPath : & oldFileName ,
52
58
NewLine : positionData .NewLine ,
53
59
OldLine : positionData .OldLine ,
54
60
}
Original file line number Diff line number Diff line change @@ -153,9 +153,9 @@ M.create_comment_layout = function(opts)
153
153
title = " Note"
154
154
user_settings = popup_settings .note
155
155
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
159
159
title =
160
160
popup .create_title (" Comment" , file_name , M .location .visual_range .start_line , M .location .visual_range .end_line )
161
161
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)
196
196
local opposite_bufnr = new_sha_focused and layout .a .file .bufnr or layout .b .file .bufnr
197
197
198
198
return {
199
- <<<<<<< HEAD
200
199
old_file_name = M .is_file_renamed () and layout .a .file .path or " " ,
201
200
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 ))
211
201
old_line_from_buf = old_line ,
212
202
new_line_from_buf = new_line ,
213
203
modification_type = modification_type ,
You can’t perform that action at this time.
0 commit comments