From f703be398f2910f8a542acaf8e7d3912736cce01 Mon Sep 17 00:00:00 2001 From: Nate Cavanaugh Date: Tue, 23 Dec 2014 07:47:38 -0800 Subject: [PATCH] If we've already fetched, we don't need to refetch --- git-pull-request/git-pull-request.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/git-pull-request/git-pull-request.py b/git-pull-request/git-pull-request.py index db6e1ee1a0..7bddecc71b 100755 --- a/git-pull-request/git-pull-request.py +++ b/git-pull-request/git-pull-request.py @@ -1049,7 +1049,14 @@ def fetch_pull_request(pull_request, repo_name): remote_branch_name = 'refs/pull/%s/head' % pull_request['number'] - ret = os.system('git fetch %s "%s":%s' % (repo_url, remote_branch_name, branch_name)) + ret = os.system('git show-ref --verify -q refs/heads/%s' % branch_name) + # sha = os.popen('git rev-parse --abbrev-ref refs/heads/%s' % branch_name).read().strip() + + # log(pull_request) + + if ret != 0: + ret = os.system('git fetch %s "%s":%s' % (repo_url, remote_branch_name, branch_name)) + if ret != 0: ret = os.system('git show-ref --verify refs/heads/%s' % branch_name)