CocoaPods / cocoapods-downloader

A small library that provides downloaders for various source types (HTTP/SVN/Git/Mercurial)
MIT License
84 stars 72 forks source link

Checkout tags without ambiguity #72

Closed keith closed 6 years ago

keith commented 6 years ago

Previously if you had a repo with a branch and a tag with the same name, using git clone --branch would prefer the branch, which may or may not be the same source as the tag. Now we checkout the tag unambiguously. The biggest downside here is we no longer do a shallow clone in this case.

segiddins commented 6 years ago

I don't think this is an acceptable change -- it will mean downloading pretty much every released pod requires an unshallow clone. Instead, why don't we try downloading with --branch, check if git describe HEAD --tags == tag, and if not fall back to the unshallow clone?

keith commented 6 years ago

That sounds reasonable to me, it looks like git describe --tags only returns a single tag if there are multiple pointing to a commit, it looks like git tag --points-at HEAD will work though. Is there any example currently of us capturing output from git commands?

Side note, if we don't think any overhead is worth doing this, since force pushing a tag has the same issue and also isn't guarded against, we can just toss this for now. Thoughts?

segiddins commented 6 years ago

target_git will return the output from the git command

keith commented 6 years ago

Ah it looks like that returns a bool if there is no output, which is what confused me

keith commented 6 years ago

Ah nevermind it looks like we're stubbing this out in tests.

keith commented 6 years ago

Submitted https://github.com/CocoaPods/cocoapods-downloader/pull/73 in place of this