Skip to content

Instantly share code, notes, and snippets.

@smoofra
Created July 23, 2015 01:11
Show Gist options
  • Save smoofra/9e43a61492867c3a70d4 to your computer and use it in GitHub Desktop.
Save smoofra/9e43a61492867c3a70d4 to your computer and use it in GitHub Desktop.
Homebrew snippet to use a git branch as a patch
class GitPatchDownloadStrategy < GitDownloadStrategy
def initialize name, resource
super
@baseref = meta[:base]
end
def stage
Homebrew.system("git", "-C", cached_location, "diff", @baseref, @ref) do
$stdout.reopen('patch')
end
end
end
#patch :p1 do
# url "https://github.com/foo/bar.git", :using => GitPatchDownloadStrategy, :base => "some-tag"
#end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment