From b697d648419f85cb391646747187d7f3a5983806 Mon Sep 17 00:00:00 2001 From: Zero King Date: Sun, 6 Jan 2019 09:19:37 +0000 Subject: [PATCH] pr: Simplify Portfile rename detection --- pr/githubapi/pull_request.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pr/githubapi/pull_request.go b/pr/githubapi/pull_request.go index 4f2c811..dae0b0f 100644 --- a/pr/githubapi/pull_request.go +++ b/pr/githubapi/pull_request.go @@ -35,14 +35,12 @@ func (client *githubClient) ListChangedPortsAndFiles(owner, repo string, number portfileRegexp := regexp.MustCompile(`[^\._/][^/]*/([^/]+)/Portfile`) // Ignore hidden and _* top directories for _, file := range allFiles { - match := portfileRegexp.FindStringSubmatch(*file.Filename) + fileName := *file.Filename + if *file.Status == "renamed" { + fileName = *file.PreviousFilename + } + match := portfileRegexp.FindStringSubmatch(fileName) if match != nil { - if *file.Status == "renamed" { - match = portfileRegexp.FindStringSubmatch(*file.PreviousFilename) - if match == nil { - continue - } - } ports = append(ports, match[1]) commitFiles = append(commitFiles, file) }