From 2f1163e14125ab7e9733473f735f221eb9d1aaeb Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sun, 1 Jun 2008 22:01:05 +0200 Subject: Major improvements to git rules. --- make/git.mk | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'make/git.mk') diff --git a/make/git.mk b/make/git.mk index 930e77a..b870f1b 100644 --- a/make/git.mk +++ b/make/git.mk @@ -1,11 +1,27 @@ +# main local branch (the one we want checked out) +master = master + +# all local branches (including those needed by child clones) +branches = $(master) + +# local name of origin +origin = origin + +currentbranch := $(shell git branch | grep \* | awk '{ print $2 }') +noncurrentbranches = $(filter-out $(currentbranch),$(branches)) + update: + $(if $(filter $(currentbranch),$(master)),,git checkout "$(master)") git pull init: - git init - git remote add -f -t "$(master)" -m "$(master)" origin "$(origin)" - git merge origin - git branch -m "$(master)" - git config remote.origin.push +"refs/heads/$(master)":"refs/heads/$(master)" +# Assume that initial cloning is done already when invoking this target +# git init +# git remote add -f -t "$(master)" -m "$(master)" origin "$(origin)" +# git merge origin +# git config remote.origin.push +"refs/heads/$(master)":"refs/heads/$(master)" + $(if $(filter $(currentbranch),$(master)),,git branch -f "$(master)" "$(origin)/$(master)") + $(if $(noncurrentbranches),$(foreach branch,$(noncurrentbranches),git branch -f "$(branch)" "$(origin)/$(branch)" &&) true) + $(if $(filter $(currentbranch),$(master)),,git checkout -f "$(master)") .PHONY: update init -- cgit v1.2.3