diff --git a/Makefile b/Makefile index 1e917ee..11a0c41 100644 --- a/Makefile +++ b/Makefile @@ -55,8 +55,9 @@ CPPFILES := $(SRC:.c=.i) $(TSTSRC:.c=.i) ##################################### pre-processor flags CPPFLAGS := -I$(BRINCDIR) -I$(INCDIR) -CPPFLAGS += -DNDEBUG # assert +CPPFLAGS += -DNDEBUG # assert (unused) CPPFLAGS += -DWARN_ON # brlib bug.h +CPPFLAGS += -DBUG_ON # brlib bug.h #CPPFLAGS += -DDEBUG # global - unused #CPPFLAGS += -DDEBUG_DEBUG # enable log() functions @@ -81,9 +82,6 @@ CPPFLAGS += -DWARN_ON # brlib bug.h CPPFLAGS += -DDIAGRAM_SYM # UTF8 symbols in diagrams -# Never comment this one ! -CPPFLAGS += -DBUG_ON # brlib bug.h - # remove extraneous spaces (due to spaces before comments) CPPFLAGS := $(strip $(CPPFLAGS)) diff --git a/scripts/fetch-all.sh b/scripts/fetch-all.sh index 399d2a8..df04b1c 100755 --- a/scripts/fetch-all.sh +++ b/scripts/fetch-all.sh @@ -1,3 +1,46 @@ #!/usr/bin/env bash -git remote | xargs -n 1 git fetch -a +origin=origin + +declare -a remotes local + +readarray -t remotes < <(git remote) +declare -A aremotes alocal_b + +# fetch all remotes +for remote in "${remotes[@]}"; do + aremotes["$remote"]=1 + echo doing git fetch -a "$remote" +done + +# get local branches +readarray -t local_b < <(git for-each-ref --format='%(refname:short)' refs/heads/) + +# build local ref array +for ref in "${local_b[@]}"; do + alocal_b[$ref]=1 +done + + +readarray -t orig_b < <(git for-each-ref --format='%(refname:short)' \ + refs/remotes/"$origin"/) + +declare -p remotes +#declare -p aremotes +declare -p local_b orig_b + +# find-out missing local branches +for remote_b in "${orig_b[@]}"; do + short=${remote_b#"$origin"/}; + echo "$remote_b -> $short ${alocal_b[$short]}" + if ! [[ -v alocal_b[$short] ]]; then + echo git switch -t "$remote_b" + fi +done + + + + + + +#git remote | xargs -n 1 git fetch -a