add support for git clone without checkout to e.g. allow configuring sparse checkouts

This commit is contained in:
Kai Tetzlaff (NSN/LinSEE) 2013-09-25 11:02:11 +02:00
parent bc073499df
commit 7c954c8e61

22
vcs.mk
View File

@ -14,13 +14,13 @@ all: updaterepos
%/initrepos: %/initrepos:
$(MAKE) -C $* $(@F) $(MAKE) -C $* $(@F)
HG := hg HG ?= hg
GIT := git GIT ?= git
BZR := bzr BZR ?= bzr
SVN := svn SVN ?= svn
#BZR := $(or $(patsubst %,"%",$(subst /,$(DIRSEP),$(wildcard c:/Program?Files/Bazaar/bzr.exe))),bzr) #BZR ?= $(or $(patsubst %,"%",$(subst /,$(DIRSEP),$(wildcard c:/Program?Files/Bazaar/bzr.exe))),bzr)
CVS := $(or $(patsubst %,"%",$(subst /,$(DIRSEP),$(wildcard c:/Program?Files/CVS?Suite/cvs.exe))),cvs) CVS ?= $(or $(patsubst %,"%",$(subst /,$(DIRSEP),$(wildcard c:/Program?Files/CVS?Suite/cvs.exe))),cvs)
#CVS := evs #CVS ?= evs
CVSFLAGS := $(shell cvs --lf --version 2>$(NULL) >$(NULL)&&echo --lf) CVSFLAGS := $(shell cvs --lf --version 2>$(NULL) >$(NULL)&&echo --lf)
CVSUP_FLAGS := -CPd CVSUP_FLAGS := -CPd
@ -126,7 +126,11 @@ define GIT_TMPL
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$(RD) $(subst /,$(DIRSEP),$1) $(RD) $(subst /,$(DIRSEP),$1)
$$(pre_init_cmd-$1) $$(pre_init_cmd-$1)
$(GIT) clone $2 $1 $(GIT) clone --verbose $(if $(GITCLONE_FLAGS-$1),$(GITCLONE_FLAGS-$1)$(sp))$2 $1
ifneq (,$(filter -n --no-checkout,$(GITCLONE_FLAGS-$1)))
$$(post_clone_cmd-$1)
cd $(subst /,$(DIRSEP),$1) && $(GIT) checkout
endif
$$(post_init_cmd-$1) $$(post_init_cmd-$1)
pull-$1: pull-$1:
@ -134,7 +138,7 @@ define GIT_TMPL
@echo +++ Updating[git]: $$(patsubst pull-%,%,$$@) $(SHQ)($2$(SHQ)) @echo +++ Updating[git]: $$(patsubst pull-%,%,$$@) $(SHQ)($2$(SHQ))
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$$(pre_up_cmd-$1) $$(pre_up_cmd-$1)
@cd $(subst /,$(DIRSEP),$1) >$(NULL) 2>&1 && $(GIT) pull $(GITPULL_FLAGS) $(GIT) --work-tree $1 pull $(GITPULL_FLAGS)
$$(post_up_cmd-$1) $$(post_up_cmd-$1)
endif endif