Skip to content

Use file_mode to guide position tracing

This MR fixes position tracing issues for diff_notes with symlink typechanges. We cannot use file_identifier_hash to find the right diff_file when we are tracing changes via switching diff_refs as file_identifer_hash value would be different based on the diff_refs.

For example, since Symlink -> regular file change commit generates one deletion of symlink and one addition of regular file, we need to be able to track the change of the correct diff_file of the diff_note. However if the diff_note was made on the regular file and the file gets updated in the subsequent commit, file_identifier_hash would be different when we look for bd_diffs as it would be considered as updated file not a new file.

This is one of several changes that we needed to make to support symlink changes.

The scenario is if you already have the symlink or regular file in the target branch. So you need to merge that symlink commit to master first and create a separate MR that changes the existing symlink to a regular file. You'll then be presented with one deleted symlink diff_file and one added regular diff_file which shares the same file_path.

Also, this isn't something we can test via UI currently since the FE work hasn't been done for this. Currently, you can comment on the delete portion of this typechange, but not on the new file regular file that replaces this symlink.

This MR is getting the backend ready to accept file_identifier_hash and use it to correctly choose the right diff_file during position tracing. I've encountered this while I was fiddling with FE code and stumbled on this issue so it needs to be fixed before the FE starts using this.

Related to #33867

Edited by Sincheol (David) Kim

Merge request reports