This strategy is only used in one formula, so we can just replace it
with a dependency. It could be done with a requirement, but since this
is a low-impact change (it only matters for head builds on Leopard), I'm
not sure it's worth the effort.
The constant is retained for compatibility, though I could find only one
other reference to it on GitHub, in a formula that was removed from core
almost two years ago.
Per the `git-rev-parse(1)` manpage:
--verify Verify that exactly one parameter is provided, and that it
can be turned into a raw 20-byte SHA-1 that can be used to access the
object database. If so, emit it to the standard output; otherwise,
error out.
If you want to make sure that the output actually names an object in
your object database and/or can be used as a specific type of object
For example, git rev-parse "$VAR^{commit}" will make sure $VAR names
an existing object that is a commit-ish (i.e. a commit, or an
annotated tag that points at a commit).
That actually means that:
git rev-parse --verify af8e768e2bd3b4398bca033998f83b0eb8874914
will _always_ return the SHA-1 hash — regardless of whether or not
that's actually a valid reference!
Thus, when `GitDownloadStragtegy#update_repo` tries to check
`has_ref?`, it mistakenly succeeds, and doesn't actually do a `git fetch
origin`.
The fix is to use:
git rev-parse --verify "af8e768e2bd3b4398bca033998f83b0eb8874914^{commit}"
FixesHomebrew/homebrew#31045.
ClosesHomebrew/homebrew#31054.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
When nested submodules appear in a git repository, the `git submodule foreach
git checkout-index ..` command would fail because it would checkout at the root
directory instead of in its parent(s)' folder.
Eg: root/submodule1/submodule2 would be checked out in root/submodule2
ClosesHomebrew/homebrew#30841.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Git repositories should always be updated when the ref is a branch.
They should be also updated if no ref was specified or if the ref isn’t
present. This stops the repo being updated if we’re building a specific
revision and it is present. Additionally, this stops the update barfing
on repositories where we’re using a revision and there is no upstream
`master` branch.
ClosesHomebrew/homebrew#29218.
We know what strategy we want, so going through DownloadStrategyDetector
is wasted work. Now we can remove those patterns from the detector and
have two fewer branches each time through.
Ruby's OpenURI library is somewhat broken under 1.8 and chokes on
otherwise valid values of http(s)_proxy. Use curl to get the mirror list
instead.
FixesHomebrew/homebrew#23708.