@@ -324,8 +324,7 @@ def crossbow(obj, crossbow):
324
324
obj ['crossbow_repo' ] = crossbow
325
325
326
326
327
- def _clone_arrow_and_crossbow (dest , crossbow_repo , arrow_repo_url ,
328
- pr_number , pr_branch ):
327
+ def _clone_arrow_and_crossbow (dest , crossbow_repo , arrow_repo_url , pr_number ):
329
328
"""
330
329
Clone the repositories and initialize crossbow objects.
331
330
@@ -335,23 +334,25 @@ def _clone_arrow_and_crossbow(dest, crossbow_repo, arrow_repo_url,
335
334
Filesystem path to clone the repositories to.
336
335
crossbow_repo : str
337
336
GitHub repository name, like kszucs/crossbow.
338
- pull_request : pygithub.PullRequest
339
- Object containing information about the pull request the comment bot
340
- was triggered from.
337
+ arrow_repo_url : str
338
+ Target Apache Arrow repository's clone URL, such as
339
+ "https://github.com/apache/arrow.git".
340
+ pr_number : int
341
+ Target PR number.
341
342
"""
342
- bare_arrow_path = dest / 'arrow_bare'
343
343
arrow_path = dest / 'arrow'
344
344
queue_path = dest / 'crossbow'
345
345
346
+ # we use unique branch name instead of fork's branch name to avoid
347
+ # branch name conflict such as 'main' (GH-39996)
348
+ local_branch = f'archery/pr-{ pr_number } '
346
349
# 1. clone arrow and checkout the PR's branch
347
- pr_ref = f'pull/{ pr_number } /head:{ pr_branch } '
348
- # we do a bare clone of upstream arrow to avoid issues when the PR is
349
- # submitted from a fork's main branch (GH-39996)
350
- git .clone ('--bare' , arrow_repo_url , str (bare_arrow_path ))
351
- # fetch the PR's branch into the bare clone
352
- git .fetch ('origin' , pr_ref , git_dir = bare_arrow_path )
353
- # clone and checkout the PR's branch into a full local repo
354
- git .clone (f'--branch={ pr_branch } ' , bare_arrow_path , arrow_path )
350
+ pr_ref = f'pull/{ pr_number } /head:{ local_branch } '
351
+ git .clone ('--no-checkout' , arrow_repo_url , str (arrow_path ))
352
+ # fetch the PR's branch into the clone
353
+ git .fetch ('origin' , pr_ref , git_dir = arrow_path )
354
+ # checkout the PR's branch into the clone
355
+ git .checkout (local_branch , git_dir = arrow_path )
355
356
356
357
# 2. clone crossbow repository
357
358
crossbow_url = 'https://github.com/{}' .format (crossbow_repo )
@@ -391,7 +392,6 @@ def submit(obj, tasks, groups, params, arrow_version, wait):
391
392
crossbow_repo = crossbow_repo ,
392
393
arrow_repo_url = pull_request .base .repo .clone_url ,
393
394
pr_number = pull_request .number ,
394
- pr_branch = pull_request .head .ref ,
395
395
)
396
396
# load available tasks configuration and groups from yaml
397
397
config = Config .load_yaml (arrow .path / "dev" / "tasks" / "tasks.yml" )
0 commit comments