@@ -204,7 +204,7 @@ func Changes(cmd CommandRunner, baseBranch string, filter PathFilter) ([]*FileCh
204204 slog .Debug ("File was turned into a symlink" , slog .String ("path" , change .Path .After .Name ))
205205 change .Body .ModifiedLines = CountLines (change .Body .After )
206206 case change .Path .Before .Type != Missing && change .Path .After .Type != Missing && change .Path .After .Type != Symlink :
207- change .Body .ModifiedLines , err = getModifiedLines (cmd , change .Commits , change .Path .After .EffectivePath (), lastCommit )
207+ change .Body .ModifiedLines , err = getModifiedLines (cmd , change .Commits , change .Path .After .EffectivePath (), lastCommit , change . Body . Before , change . Body . After )
208208 if err != nil {
209209 return nil , fmt .Errorf ("failed to run git blame for %s: %w" , change .Path .After .EffectivePath (), err )
210210 }
@@ -261,7 +261,7 @@ func getChangeByPath(changes []*FileChange, fpath string) *FileChange {
261261 return nil
262262}
263263
264- func getModifiedLines (cmd CommandRunner , commits []string , fpath , atCommit string ) ([]int , error ) {
264+ func getModifiedLines (cmd CommandRunner , commits []string , fpath , atCommit string , bodyBefore , bodyAfter [] byte ) ([]int , error ) {
265265 slog .Debug ("Getting list of modified lines" ,
266266 slog .Any ("commits" , commits ),
267267 slog .String ("path" , fpath ),
@@ -271,11 +271,21 @@ func getModifiedLines(cmd CommandRunner, commits []string, fpath, atCommit strin
271271 return nil , err
272272 }
273273
274+ linesBefore := bytes .Split (bodyBefore , []byte ("\n " ))
275+ linesAfter := bytes .Split (bodyAfter , []byte ("\n " ))
276+
274277 modLines := make ([]int , 0 , len (lines ))
275278 for _ , line := range lines {
276279 if ! slices .Contains (commits , line .Commit ) && line .Line == line .PrevLine {
277280 continue
278281 }
282+
283+ if line .PrevLine <= len (linesBefore ) && line .Line <= len (linesAfter ) {
284+ if bytes .Equal (linesBefore [line .PrevLine - 1 ], linesAfter [line .Line - 1 ]) {
285+ continue
286+ }
287+ }
288+
279289 modLines = append (modLines , line .Line )
280290 }
281291 slog .Debug ("List of modified lines" ,
0 commit comments