tool/port: limit destructive git operations to port

Issue #2959
This commit is contained in:
Christian Helmuth 2018-09-04 12:03:30 +02:00 committed by Norman Feske
parent a6acdac1cf
commit a6d7d5da07
2 changed files with 4 additions and 1 deletions

View File

@ -8,6 +8,9 @@ SHELL := bash
VERBOSE ?= @
ECHO := echo -e
# limit destructive git operations (e.g., reset) to local directory
GIT := git --git-dir=.git
BRIGHT_COL ?= \x1b[01;33m
DARK_COL ?= \x1b[00;33m
DEFAULT_COL ?= \x1b[0m

View File

@ -162,7 +162,7 @@ _git_dir = $(call _assert,$(DIR($1)),Missing declaration of DIR($*))
test -d $$dir || $(MSG_DOWNLOAD)$(URL($*)); \
test -d $$dir || git clone $(URL($*)) $$dir &> >(sed 's/^/$(MSG_GIT)/'); \
$(MSG_UPDATE)$$dir; \
cd $$dir && git fetch && git reset -q --hard HEAD && git checkout -q $(REV($*))
cd $$dir && $(GIT) fetch && $(GIT) reset -q --hard HEAD && $(GIT) checkout -q $(REV($*))
##