From 4731ec4426d5917f43f4d313928c45ec38adf3de Mon Sep 17 00:00:00 2001 From: "iannucci@chromium.org" Date: Thu, 7 Nov 2013 19:03:12 +0000 Subject: [PATCH] Fix upstream.sh presubmit test for git 1.8.3+ Previously this relied on being able to track branches which didn't have a remote refspec. Now we add a fake origin for the git-svn test repo, and use --prefix so that git has a remote to track and the refs are correctly namespaced. Should also be backwards compatible with older versions of git. R=maruel@chromium.org BUG= Review URL: https://codereview.chromium.org/61893006 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@233649 0039d316-1c4b-4281-b951-d872f2087c98 --- tests/test-lib.sh | 3 ++- tests/upstream.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test-lib.sh b/tests/test-lib.sh index ad0781804..92ec3bbdd 100755 --- a/tests/test-lib.sh +++ b/tests/test-lib.sh @@ -49,9 +49,10 @@ setup_gitsvn() { rm -rf git-svn # There appears to be no way to make git-svn completely shut up, so we # redirect its output. - git svn -q clone -s $REPO_URL git-svn >/dev/null 2>&1 + git svn --prefix origin/ -q clone -s $REPO_URL git-svn >/dev/null 2>&1 ( cd git-svn + git remote add origin https://example.com/fake_refspec git config user.name 'TestDood' git config user.email 'TestDood@example.com' ) diff --git a/tests/upstream.sh b/tests/upstream.sh index 0e2ce80b0..b264b3e94 100755 --- a/tests/upstream.sh +++ b/tests/upstream.sh @@ -19,7 +19,7 @@ setup_gitsvn git config rietveld.server localhost:8080 - for ref in refs/remotes/trunk refs/remotes/some_branch; do + for ref in refs/remotes/origin/trunk refs/remotes/origin/some_branch; do git branch -f --set-upstream feature_branch $ref git checkout -q feature_branch test_expect_success "Guessing upstream branch for $ref" \