-
Notifications
You must be signed in to change notification settings - Fork 776
Description
Expected behavior and actual behavior
Expected: When running a pipeline with -revision where the branch exists on the remote repository, Nextflow should fetch and checkout that branch successfully.
Actual: When using the multi-revision repository strategy (default since ~25.x), attempting to pull a branch that exists on the remote but hasn't been fetched locally fails with the error:
Remote does not have <branch-name> available for fetch.
This only affects branches that exist on the remote but are not yet present in the local bare repository. Once a branch has been fetched at least once, subsequent pulls work correctly.
Steps to reproduce the problem
- Ensure you're using a recent Nextflow version with multi-revision mode enabled (default)
- Try to run or pull a pipeline with a branch that you haven't fetched before:
Clear any cached repos to ensure fresh state
rm -rf ~/.nextflow/assets/nf-core ~/.nextflow/.repos/nf-coreTry to pull a branch that exists on the remote
nextflow pull nf-core/fetchngs -revision preview-26-04Or with any GitHub repository that has a branch not yet fetched:
nextflow run nf-core/fetchngs -revision preview-26-04Program output
N E X T F L O W ~ version 25.12.0-edge
Pulling nf-core/fetchngs:preview-26-04 ...
Remote does not have preview-26-04 available for fetch.
Environment
- Nextflow version: 25.12.0-edge (and likely earlier versions with multi-revision mode)
- Java version: 21
- Operating system: macOS / Linux
- Bash version: N/A (not bash-related)
Additional context
Root cause: In MultiRevisionRepositoryStrategy.refSpecForName(), when determining the correct RefSpec for fetching, the code only checks local refs in the
bare repository:
Ref branch = getBareGit().getRepository().findRef("refs/heads/" + revision)For a new branch that doesn't exist locally, this returns null, causing the method to fall through and treat the branch name as a commit SHA:
return new RefSpec(revision + ":refs/tags/" + revision)This creates an invalid RefSpec like preview-26-04:refs/tags/preview-26-04, which JGit fails to fetch because there's no commit with that literal name.
Fix: The method should query remote refs via lsRemote() when the revision is not found locally, before falling back to treating it as a commit SHA.