git fetch --unshallow --tags might not be enough?
felixfbecker opened this issue · comments
I remember from setting up https://github.com/finom/last-release-git that just running get fetch --unshallow --tags
was not enough to fetch tags because Travis also clones with the single-branch option. The only way to fix that was to correct the remotes:
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch --tags
As in https://stackoverflow.com/questions/17714159/how-do-i-undo-a-single-branch-clone
Just wanted to give this heads up, if you tested this and it works in Travis, feel free to close :)
Travis doesn't use the --single-branch
option when cloning, at least not on recent builds.
That said, even wit the --single-branch
option it should work. This option clone only one branch and therefore doing a git fetch
will fetch only the commits of that branch.
As we want to retrieve only the tags in the history of the branch it's not a problem, on the contrary.
Actually I use git tag --merge HEAD
to retrieve the tags and make sure to retrieve only the ones in the current branch history, in case the repo was cloned without --single-branch
@felixfbecker did you think there might still be a problem here? Or should we close the issue?
No, from my testing everything works fine! 🙌
Thanks for the feedback and the tests!