I'm new to GIT and GitHub (and Homebrew for that matter); the formula for emacs in the main repository is broken in OS X Lion, but there is a "pull request" (https://github.com/mxcl/homebrew/pull/6518) that fixes the problem (but it isn't merged in the main repository).
How can I update my local copy of the Homebrew repository to have that formula fixed ? If I manage that, will that formula still be updated if the main repository includes that fix ?
Please correct me if the terminology is not correct.
Packages are installed according to their formulae, which live in /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula .
You can install a Homebrew formula directly from a pull request by using brew install $raw_pull_requst_url
, eg:
brew install https://raw.github.com/ColinHebert/homebrew/538a99cc06a8f40b6ebcf2f4f8fd44d563c672cd/Library/Formula/emacs.rb
For finding the pull request URL, there's probably a better way, but I went to the pull request URL you linked, clicked on Files Changed, then on View File @ 9b22d42, then finally on Raw
The documentation on Github describes that quite verbose (section Merging a Pull Request):
on your repo:
git checkout master
git remote add colin https://github.com/ColinHebert/homebrew.git
git fetch colin
Now, you have the full content of the colin
repo (including knowledge of the commit hashes used in that repo). Next is to apply the changes. The docs say that you should do a git merge
, but that's not so good in our case since colin added the changes to his master
. If he works on master
(and does some more commits), you'll get these changes too.
Fortunately, the four commits making up the patch are named in the Pull-request: ae28b29e
, df10b69a
, e8915488
, 87f2d1e5
. You can apply them with git cherry-pick
:
git cherry-pick ae28b29e
git cherry-pick df10b69a
git cherry-pick e8915488
git cherry-pick 87f2d1e5
That's it. You could now delete the remote colin
with
git remote rm colin
Another possibility would be to download the patch and apply it:
git checkout master
curl https://github.com/mxcl/homebrew/pull/6518.patch | git am
The patches for pull requests are always available via
https://github.com/<user>/<repo>/pull/<request_number>.patch
I found the following to be better for the casual homebrew user.
If you are searching for a fix there will be a pull number:
| => brew search vmdktool
No formula found for "vmdktool".
==> Searching pull requests...
Open pull requests:
vmdktool 1.4 (new formula) (https://github.com/Homebrew/homebrew-core/pull/9109)
Just do brew pull ####
where ####
is the pull number:
| => brew pull 9109
fatal: ref HEAD is not a symbolic ref
Warning: Current branch is : do you need to pull inside master?
==> Fetching patch
Patch: https://github.com/Homebrew/homebrew-core/pull/9109.patch
==> Applying patch
Applying: vmdktool 1.4 (new formula)
==> Patch closes issue #9109
==> Patch changed:
Formula/vmdktool.rb | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
then do your install/upgrade:
| => brew install vmdktool
Updating Homebrew...
==> Auto-updated Homebrew!
Updated Homebrew from 11cf7b9 to 1f97e31.
No changes to formulae.
==> Using the sandbox
==> Downloading https://people.freebsd.org/~brian/vmdktool/vmdktool-1.4.tar.gz
######################################################################## 100.0%
==> make CFLAGS='-D_GNU_SOURCE -g -O -pipe'
==> make install PREFIX=/usr/local/Cellar/vmdktool/1.4
🍺 /usr/local/Cellar/vmdktool/1.4: 4 files, 34.4K, built in 2 seconds
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With