You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given I clone a git repository using git on my local machine, so without this lib, the remote.origin.fetch targets +refs/heads/*:refs/remotes/origin/* while when I clone the same repo but with this lib the the remote.origin.fetch targets +refs/heads/master:refs/remotes/origin/master.
This makes the fetch method not being able to retrieve other branches references and therefore the reset_hard method to fail with:
fatal: ambiguous argument 'origin/8-missing-reference-language-translation-files-in-yml': unknown revision or path not in the working tree.
Your environment
version of git: 2.32.6
version of ruby-git: 1.18.0
version of ruby: 2.7.6
Steps to reproduce
git=Git.clone(URL,destination)# Supposed to retrieve all the remote branch refs, but is notgit.remote(Git::GIT_REMOTE_NAME).fetch# Switches to the desired branchgit.branch('8-missing-reference-language-translation-files-in-yml').checkout# Here we want to be fully aligned with the remote branchgit.reset_hard("#{Git::GIT_REMOTE_NAME}/8-missing-reference-language-translation-files-in-yml")#=> fatal: ambiguous argument 'origin/8-missing-reference-language-translation-files-in-yml': unknown revision or path not in the working tree.
It appears this is a behaviour comes from git itself when passing the --depth flag.
One way to solve this is to call the git remote set-branches origin '*' as explain in this SO but this library doesn't seem to support it.
The alternative way of doing this is to update the .git/config file manually as described in the this issue.
For now, I will stop using the --depth flag. It would be nice to have that set-branches supported by this library 👍
Subject of the issue
Given I clone a git repository using git on my local machine, so without this lib, the
remote.origin.fetch
targets+refs/heads/*:refs/remotes/origin/*
while when I clone the same repo but with this lib the theremote.origin.fetch
targets+refs/heads/master:refs/remotes/origin/master
.This makes the
fetch
method not being able to retrieve other branches references and therefore thereset_hard
method to fail with:Your environment
2.32.6
1.18.0
2.7.6
Steps to reproduce
Expected behaviour
The
remote.origin.fetch
should be changed from:to:
Actual behaviour
See "Steps to reproduce"
The text was updated successfully, but these errors were encountered: