diff --git a/git/adapter/commit.go b/git/adapter/commit.go index 023b1287e..1f7ff36e6 100644 --- a/git/adapter/commit.go +++ b/git/adapter/commit.go @@ -374,12 +374,11 @@ func getChangeInfoTypes( return changeInfoTypes, nil } -// Will match "31\t0\t.harness/apidiff.yaml". -// Will extract 31, 0 and .harness/apidiff.yaml. -var insertionsDeletionsRegex = regexp.MustCompile(`(\d+)\t(\d+)\t(.+)`) +// Will match "31\t0\t.harness/apidiff.yaml" and extract 31, 0 and .harness/apidiff.yaml. +// Will match "-\t-\ttools/code-api/chart/charts/harness-common-1.0.27.tgz" and extract -, -, and a filename. +var insertionsDeletionsRegex = regexp.MustCompile(`(\d+|-)\t(\d+|-)\t(.+)`) -// Will match "0\t0\tREADME.md => README_new.md". -// Will extract README_new.md. +// Will match "0\t0\tREADME.md => README_new.md" and extract README_new.md. var renameRegexWithArrow = regexp.MustCompile(`\d+\t\d+\t.+\s=>\s(.+)`) func getChangeInfoChanges( @@ -404,6 +403,11 @@ func getChangeInfoChanges( path = renMatches[1] } + if matches[1] == "-" || matches[2] == "-" { + changeInfos[path] = changeInfoChange{} + continue + } + insertions, err := strconv.ParseInt(matches[1], 10, 64) if err != nil { return map[string]changeInfoChange{},