-
Notifications
You must be signed in to change notification settings - Fork 222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SCM module does not checkout git branch if the repo already exists #1630
Comments
I am happy to sponsor this bug. Looking at the code for |
Thanks for reporting, @abeverley, as well as kindly offering to sponsor working on this! Based on a quick software archaeology study, original intent looks like “if the repo already exists, update it with git pull; if a branch is passed, pull the branch”. That results in the correct commits on the wrong branch in the cloned repo. I agree this is confusing, and we probably can find a way to make the results both “more correct” and more consistent across use cases. I still would like to take another deeper look to make sure we can do all that accidentally without breaking backwards compatibility. Even then, I currently still lean towards treating it as a bug, and fixing it properly, rather than preserving a confusing behavior. The good news is that I already implemented initial tests for Rex::SCM::Git in |
As a workaround, |
Describe the bug
When using
checkout
fromRex::Commands::SCM
, if the repo already exists in the target dir, then a specified branch is not checked-out. E.g.If
target_dir
already exists thenother_branch
is not checked-outExpected behavior
After running the above command, I expect
git status
to show it is on theother_branch
branch.How to reproduce it
checkout "my_repo", branch => 'master', path => 'target_dir';
checkout "my_repo", branch => 'other_branch', path => 'target_dir';
Code example
No response
Additional context
No response
Rex version
1.14.3
Perl version
5.34.0
Operating system running rex
Ubuntu 22.04
Operating system managed by rex
Debian
How rex was installed?
cpan client
The text was updated successfully, but these errors were encountered: