diff options
author | Jonas Smedegaard <dr@jones.dk> | 2008-09-30 22:07:20 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2008-09-30 22:07:20 +0200 |
commit | 366929d83dc8b9a6620d49c4a8b96c16cf2de8a0 (patch) | |
tree | 646018f3a1c61e302881aa45769d0d36475b04d7 /make/git.mk | |
parent | 2e07dd9c0356e419eaec48f84fcd6172b9418b85 (diff) | |
parent | f2ddf72b26f2f6d318f41264573787f505339b8e (diff) |
Merge branch 'master' into wian
Diffstat (limited to 'make/git.mk')
-rw-r--r-- | make/git.mk | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/make/git.mk b/make/git.mk index 072617e..2c8c827 100644 --- a/make/git.mk +++ b/make/git.mk @@ -7,14 +7,24 @@ branches = $(master) # local name of origin origin = origin -currentbranch = $(shell git branch | grep ^\* | awk '{ print $2 }') -noncurrentbranches = $(filter-out $(currentbranch),$(branches)) +allbranches = $(sort $(master) $(branches)) +currentbranch := $(shell git branch | grep ^\* | awk '{ print $2 }') +noncurrentbranches := $(filter-out $(currentbranch),$(branches)) + +#originbranches := $(shell git branch -r | perl -ne 'm,^.\s+'"$$origin"'/([a-z_]\S+)$, && print "$$1\n"' ) +localbranches := $(shell git branch | perl -ne 'm,^.\s+([a-z_]\S+)$$, && print "$$1\n"' ) update: git fetch $(origin) - $(if $(filter $(currentbranch),$(master)),,git branch -f "$(master)" "$(origin)/$(master)" && git checkout "$(master)") - git pull "$(origin)" - $(if $(noncurrentbranches),$(foreach branch,$(noncurrentbranches),git branch -f "$(branch)" "$(origin)/$(branch)" && git checkout "$(branch)" && git pull "$(origin)" &&) git checkout "$(master)") + for branch in $(filter-out $(localbranches),$(allbranches)); do \ + git branch $$branch $(origin)/$$branch; \ + done + for branch in $(noncurrentbranches); do \ + git checkout $$branch; \ + git pull $(origin); \ + done + git checkout $(master) + git pull $(origin) init: git init |