From 01717a2738d3266fc03e959f5d19d6354604f652 Mon Sep 17 00:00:00 2001 From: Zero King Date: Sun, 6 Jan 2019 02:27:04 +0000 Subject: [PATCH] pr: Detect port renames --- pr/githubapi/pull_request.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pr/githubapi/pull_request.go b/pr/githubapi/pull_request.go index 058cbbb..4f2c811 100644 --- a/pr/githubapi/pull_request.go +++ b/pr/githubapi/pull_request.go @@ -35,7 +35,14 @@ func (client *githubClient) ListChangedPortsAndFiles(owner, repo string, number portfileRegexp := regexp.MustCompile(`[^\._/][^/]*/([^/]+)/Portfile`) // Ignore hidden and _* top directories for _, file := range allFiles { - if match := portfileRegexp.FindStringSubmatch(*file.Filename); match != nil { + match := portfileRegexp.FindStringSubmatch(*file.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) }