@@ -1194,8 +1194,8 @@ func DiffReports(gitRepo string, diffArgs []string, changesList []git.Change, ch
11941194 }
11951195 }
11961196
1197- old := reportListToMap (oldList )
1198- new := reportListToMap (newList )
1197+ oldReportMap := reportListToMap (oldList )
1198+ newReportMap := reportListToMap (newList )
11991199 changes := gitChangesToMap (changesList )
12001200
12011201 var mu sync.Mutex
@@ -1205,7 +1205,7 @@ func DiffReports(gitRepo string, diffArgs []string, changesList []git.Change, ch
12051205
12061206 limitCh := make (chan struct {}, maxConcurrency )
12071207
1208- for filename , list := range new {
1208+ for filename , list := range newReportMap {
12091209 wg .Add (1 )
12101210 go func (filename string , list []* Report ) {
12111211 limitCh <- struct {}{}
@@ -1221,7 +1221,7 @@ func DiffReports(gitRepo string, diffArgs []string, changesList []git.Change, ch
12211221 oldName = filename // full diff mode
12221222 }
12231223
1224- reports , err := diffReportsList (gitRepo , ignoreCommits , diffArgs , filename , c , old [oldName ], list )
1224+ reports , err := diffReportsList (gitRepo , ignoreCommits , diffArgs , filename , c , oldReportMap [oldName ], list )
12251225 if err != nil {
12261226 mu .Lock ()
12271227 resErr = err
@@ -1275,8 +1275,8 @@ func diffReportsList(gitRepo string, ignoreCommits map[string]struct{}, diffArgs
12751275 }
12761276 }
12771277
1278- old , oldMaxLine := reportListToPerLineMap (oldList )
1279- new , newMaxLine := reportListToPerLineMap (newList )
1278+ oldReportMap , oldMaxLine := reportListToPerLineMap (oldList )
1279+ newReportMap , newMaxLine := reportListToPerLineMap (newList )
12801280
12811281 var maxLine = oldMaxLine
12821282 if newMaxLine > maxLine {
@@ -1293,17 +1293,17 @@ func diffReportsList(gitRepo string, ignoreCommits map[string]struct{}, diffArgs
12931293 // just deletion
12941294 if ok && ch .new .HaveRange && ch .new .Range == 0 {
12951295 oldLine = ch .old .To
1296- newLine -- // cancel the increment of newLine, because code was deleted, no new lines added
1296+ newLine -- // cancel the increment of newLine, because code was deleted, no newReportMap lines added
12971297 continue
12981298 }
12991299
1300- res = maybeAppendReports (res , new , old , newLine , oldLine , blame , ignoreCommits )
1300+ res = maybeAppendReports (res , newReportMap , oldReportMap , newLine , oldLine , blame , ignoreCommits )
13011301
13021302 if ok {
13031303 oldLine = 0 // all changes and additions must be checked
13041304 for j := newLine + 1 ; j <= ch .new .To ; j ++ {
13051305 newLine = j
1306- res = maybeAppendReports (res , new , old , newLine , oldLine , blame , ignoreCommits )
1306+ res = maybeAppendReports (res , newReportMap , oldReportMap , newLine , oldLine , blame , ignoreCommits )
13071307 }
13081308 oldLine = ch .old .To
13091309 }
0 commit comments