From 20754c0f5c98342930910650c29ccec449149a96 Mon Sep 17 00:00:00 2001 From: Ryan Hitchman Date: Fri, 28 Oct 2016 11:50:21 -0700 Subject: [PATCH] Improve update_owners.py username detection and error message. Also, skip _output. --- hack/update_owners.py | 12 ++++++------ test/list/main.go | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/hack/update_owners.py b/hack/update_owners.py index dd4237686014..e464ee509e6a 100755 --- a/hack/update_owners.py +++ b/hack/update_owners.py @@ -116,12 +116,12 @@ def get_maintainers(): def detect_github_username(): - remotes = subprocess.check_output(['git', 'remote', '-v']) - repos = set(re.findall(r'\w+(?=/kubernetes)', remotes)) - repos.remove('kubernetes') - if len(repos) == 1: - return repos.pop() - raise ValueError('unable to guess GitHub user from `git remote -v` output, use --user instead') + origin_url = subprocess.check_output(['git', 'config', 'remote.origin.url']) + m = re.search(r'github.com[:/](.*)/', origin_url) + if m and m.group(1) != 'kubernetes': + return m.group(1) + raise ValueError('unable to determine GitHub user from ' + '`git config remote.origin.url` output, run with --user instead') def main(): diff --git a/test/list/main.go b/test/list/main.go index 3bb421ac49dc..b7b25e9d687e 100644 --- a/test/list/main.go +++ b/test/list/main.go @@ -237,7 +237,8 @@ func (t *testList) handlePath(path string, info os.FileInfo, err error) error { return err } if strings.Contains(path, "third_party") || - strings.Contains(path, "staging") { + strings.Contains(path, "staging") || + strings.Contains(path, "_output") { return filepath.SkipDir } if strings.HasSuffix(path, ".go") && strings.Contains(path, "e2e") ||