Fix fetching new remote branch in multi-revision mode#6733
Fix fetching new remote branch in multi-revision mode#6733bentsherman merged 7 commits intomasterfrom
Conversation
✅ Deploy Preview for nextflow-docs-staging canceled.
|
jorgee
left a comment
There was a problem hiding this comment.
Thank you @robsyme, for the bug catch, the fix and the smart unit test. Changes looks fine. I have just removed the fetchRemoteRefs() because the implementation is the same as lsRemote(false), and I have also added tags case in the test.
|
Ah, I didn't understand the |
…on mode This test demonstrates the bug where trying to fetch a branch that exists on the remote but not in the local bare repository fails. Signed-off-by: Rob Syme <rob.syme@seqera.io> Signed-off-by: Rob Syme <rob.syme@gmail.com>
…on mode The refSpecForName method was only checking local refs in the bare repository. For branches that exist on the remote but haven't been fetched yet, this caused the method to incorrectly treat the branch name as a commit SHA, resulting in a fetch error. Now the method queries remote refs via ls-remote when the revision is not found locally, allowing new remote branches to be fetched correctly. Fixes the error: 'Remote does not have <branch> available for fetch' Signed-off-by: Rob Syme <rob.syme@seqera.io> Signed-off-by: Rob Syme <rob.syme@gmail.com>
Signed-off-by: Rob Syme <rob.syme@seqera.io> Signed-off-by: Rob Syme <rob.syme@gmail.com>
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
debd266 to
9bc093c
Compare
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
|
@jorgee I tried to make it more Groovy but I think I broke something 😞 Can you double check my work? |
|
I think you're running into a GString vs String issue, Ben (they hash differently because Groovy). I think I can fix with a |
Signed-off-by: Rob Syme <rob.syme@gmail.com>
|
Thanks Rob. Weird that the GString would break there, but whatever. Tests are passing ✔️ |
|
Thanks for collab, team. Much appreciated. Ben - the GString breaks because it's used as a HashMap lookup down the call tree, which uses the hash for identity, leading to a missed key in the HashMap. |
Summary
refSpecForName()method now queries remote refs vialsRemote()when a revision is not found locally, before falling back to treating it as a commit SHA@Memoizedhelper methodfetchRemoteRefs()to cache results and avoid redundant network callsFixes #6732
Test plan
should fetch new remote branch not in local bare repothat verifies fetching a branch not present locallyshould create correct RefSpec for branches tags and commitsthat verifies fallback behavior without network accessnextflow pull nf-core/fetchngs -revision preview-26-04now works correctly🤖 Generated with Claude Code