From 12cd938db336f7a37d31531653c4e52e0dda55a4 Mon Sep 17 00:00:00 2001 From: spacewander Date: Sun, 16 Jul 2017 16:28:14 +0800 Subject: [PATCH] install: submit brew patch to upstream Follow the atempt of pull request #491 --- .travis.yml | 8 +++++++- Makefile | 4 ++++ brew-release.patch | 24 ++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 brew-release.patch diff --git a/.travis.yml b/.travis.yml index 46c0dc6..2c1a519 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,10 @@ os: - linux - osx -script: ./check_integrity.sh $(find bin | cut -b 5- | xargs) +script: + - ./check_integrity.sh $(find bin | cut -b 5- | xargs) + # Test for the brew release + - mkdir ../release && git archive --format=tar.gz HEAD > ../release/git-extras-release.tar.gz + - cd ../release + - tar -xzf git-extras-release.tar.gz && make PREFIX=$(pwd) INSTALL_VIA=brew + - ./bin/git-extras update | grep "brew upgrade git-extras" diff --git a/Makefile b/Makefile index a87d488..f4db494 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ MANS = $(wildcard man/git-*.md) MAN_HTML = $(MANS:.md=.html) MAN_PAGES = $(MANS:.md=.1) CODE_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +INSTALL_VIA ?= source # Libraries used by all commands LIB = "helper/reset-env" "helper/git-extra-utility" @@ -17,6 +18,9 @@ default: install docs: $(MAN_HTML) $(MAN_PAGES) install: + @if [ "$(INSTALL_VIA)" = brew ]; then \ + git apply brew-release.patch || { echo "Can't apply brew release patch"; exit 1; } \ + fi @mkdir -p $(DESTDIR)$(MANPREFIX) @mkdir -p $(DESTDIR)$(BINPREFIX) @echo "... installing bins to $(DESTDIR)$(BINPREFIX)" diff --git a/brew-release.patch b/brew-release.patch new file mode 100644 index 0000000..d2e1d8b --- /dev/null +++ b/brew-release.patch @@ -0,0 +1,24 @@ +diff --git a/bin/git-extras b/bin/git-extras +index e49cd24..4ae28b5 100755 +--- a/bin/git-extras ++++ b/bin/git-extras +@@ -4,13 +4,12 @@ VERSION="4.3.0" + INSTALL_SCRIPT="https://raw.githubusercontent.com/tj/git-extras/master/install.sh" + + update() { +- local bin="$(which git-extras)" +- local prefix=${bin%/*/*} +- local orig=$PWD +- +- curl -s $INSTALL_SCRIPT | PREFIX="$prefix" bash /dev/stdin \ +- && cd "$orig" \ +- && echo "... updated git-extras $VERSION -> $(git extras --version)" ++ echo "This git-extras installation is managed by Homebrew." ++ echo "If you'd like to update git-extras, run the following:" ++ echo ++ echo " brew upgrade git-extras" ++ echo ++ return 1 + } + + updateForWindows() {