Skip to content

Apache Lucene open-source search software

Handle the case of checking out a remote branch that has never been checked out locally before

Steve Rowe74bd5d565829
diff --git a/dev-tools/scripts/reproduceJenkinsFailures.py b/dev-tools/scripts/reproduceJenkinsFailures.py
index 70f0c43fbde..edfe2d4570e 100644
--- a/dev-tools/scripts/reproduceJenkinsFailures.py
+++ b/dev-tools/scripts/reproduceJenkinsFailures.py
@@ -158,7 +158,11 @@ def prepareWorkspace(useGit, gitRef):
checkoutCmd = 'git checkout %s' % gitRef
code = run(checkoutCmd)
if 0 != code:
- raise RuntimeError('ERROR: "%s" failed. See above.' % checkoutCmd)
+ checkoutBranchCmd = 'git checkout -t -b %s origin/%s' % (gitRef, gitRef) # Checkout remote branch as new local branch
+ print('"%s" failed. Trying "%s".' % (checkoutCmd, checkoutBranchCmd))
+ code = run(checkoutBranchCmd)
+ if 0 != code:
+ raise RuntimeError('ERROR: "%s" failed. See above.' % checkoutBranchCmd)
gitCheckoutSucceeded = True
run('git merge --ff-only', rememberFailure=False) # Ignore failure on non-branch ref