diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-07-05 21:15:36 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-07-05 21:15:36 +0200 |
commit | f3c03913bb8023a8bd706b913e89dee38e8f1432 (patch) | |
tree | 14dd867c6f5d3d2330b948fb6a74c33b1f24fd17 | |
parent | 45da9631684341a4b94601f319433aa7fbb73257 (diff) | |
download | bin-f3c03913bb8023a8bd706b913e89dee38e8f1432.zip bin-f3c03913bb8023a8bd706b913e89dee38e8f1432.tar.gz |
git-synk: add USE_STASH flag
-rwxr-xr-x | git-synk | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -2,10 +2,12 @@ if [ $# -gt 0 ]; then GIT_REMOTE=$1; shift; fi if [ $# -gt 0 ]; then GIT_BRANCH=$1; shift; fi +if [ $# -gt 0 ]; then USE_STASH=1; shift; fi GIT_BASE=${GIT_BASE:-$HOME/usr/git} GIT_REMOTE=${GIT_REMOTE:-origin} GIT_BRANCH=${GIT_BRANCH:-master} +USE_STASH=${USE_STASH:-0} RESET="\033[0m" RED="\033[0;31m" @@ -15,6 +17,7 @@ PURPLE="\033[0;35m" CYAN="\033[0;36m" YELLOW="\033[1;33m" +echo -e "remote: ${RED}$GIT_REMOTE${RESET}:${CYAN}$GIT_BRANCH${RESET}" for gitdir in ${GIT_BASE}; do echo -e "enter ${BROWN}${gitdir}${RESET}" && cd ${gitdir} || return 1 for dir in $(ls -1); do @@ -29,8 +32,12 @@ for gitdir in ${GIT_BASE}; do # GC + CLEAN echo -ne " ${CYAN}clean$RESET ... " && git gc 2>/dev/null && git diff --quiet && echo -e "${GREEN}OK${RESET}" if [ $? -ne 0 ]; then - STASH=1 - echo -e "${RED}head is not clean, ${CYAN}git stash save${RESET}" && git stash save -q + if [ $USE_STASH -eq 1 ]; then + STASH=1 + echo -e "${RED}head is not clean, ${CYAN}git stash save${RESET}" && git stash save -q + else + echo -e "${RED}head is not clean, USE_STASH=0 ... ${CYAN}leave${RESET}" && cd .. && continue + fi fi # PULL echo -ne " ${CYAN}pull${RESET}: ${YELLOW}${GIT_REMOTE}${RESET}:${PURPLE}${GIT_BRANCH}${RESET} ... " && \ |