From 853f3bffb31efd3e5141b538e99713ee414e0002 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Mon, 18 Mar 2019 14:28:21 +0000 Subject: [PATCH] Use remote_url instead of remote for download If usepushurl is set, then it's likely that the pushurl is pointing to the code review system while the normal url is pointing to a read only mirror. If the read-only mirror in question doesn't contain the gerrit refs (like opendev.org currently) then git fetch origin won't work properly. However, we already calculate the correct URL at the top of the function for use in query_reviews, and fetch will happily work with a full url rather than a named remote. Update the function to use the remote_url so that usepushurl works even if the mirror url does not contain refs/changes. Change-Id: Ib72afe97e65cb1dcaf95e28450dfe6e7d5f88965 --- git_review/cmd.py | 2 +- releasenotes/notes/fix-usepushurl-c4a234689d808ece.yaml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/fix-usepushurl-c4a234689d808ece.yaml diff --git a/git_review/cmd.py b/git_review/cmd.py index a7c7dd10..b248b461 100644 --- a/git_review/cmd.py +++ b/git_review/cmd.py @@ -1195,7 +1195,7 @@ def fetch_review(review, masterbranch, remote, project): print("Downloading %s from gerrit" % refspec) run_command_exc(PatchSetGitFetchFailed, - "git", "fetch", remote, refspec) + "git", "fetch", remote_url, refspec) return branch_name, remote_branch diff --git a/releasenotes/notes/fix-usepushurl-c4a234689d808ece.yaml b/releasenotes/notes/fix-usepushurl-c4a234689d808ece.yaml new file mode 100644 index 00000000..817669b7 --- /dev/null +++ b/releasenotes/notes/fix-usepushurl-c4a234689d808ece.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Fixed ``usepushurl`` to work when a read-only mirror being used as + ``origin`` does not contain ``refs/changes`` from gerrit.