X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fxonotic.git;a=blobdiff_plain;f=all;h=9a5b07e3e5534d1e8386bdbbb5ac82ec5bc7534b;hp=14af58c4b8d4e8d57e8c65c64fe5627fdc53ae00;hb=ff0fe7591e444bd10b1f3d9136563f36c31c3dbe;hpb=8fa18b257031938af5c348456d66d52f2524c6ba diff --git a/all b/all index 14af58c4..9a5b07e3 100755 --- a/all +++ b/all @@ -895,19 +895,35 @@ case "$cmd" in clean) force=false gotoupstream=false + fetchupstream=false gotomaster=false rmuntracked=false killbranches=false # usage: - # ./all clean [-m] [-f | -fu] [-r] [-D] + # ./all clean [-m] [-f | -fu | -fU] [-r] [-D] + # ./all clean --reclone while :; do - if [ x"$1" = x"-f" ]; then + if [ x"$1" = x"--reclone" ]; then + force=true + fetchupstream=true + gotoupstream=true + gotomaster=true + rmuntracked=true + killbranches=true + elif [ x"$1" = x"-f" ]; then force=true elif [ x"$1" = x"-u" ]; then gotoupstream=true + elif [ x"$1" = x"-U" ]; then + gotoupstream=true + fetchupstream=true elif [ x"$1" = x"-fu" ]; then force=true gotoupstream=true + elif [ x"$1" = x"-Fu" ]; then + force=true + gotoupstream=true + fetchupstream=true elif [ x"$1" = x"-m" ]; then gotomaster=true elif [ x"$1" = x"-r" ]; then @@ -927,14 +943,20 @@ case "$cmd" in exit 1 fi if $gotomaster; then + if $fetchupstream; then + verbose git fetch origin + fi verbose git checkout -f "`repobranch "$d"`" - git reset --hard origin/"`repobranch "$d"`" + verbose git reset --hard origin/"`repobranch "$d"`" else r=`git symbolic-ref HEAD` r=${r#refs/heads/} rem=`git config "branch.$r.remote" || echo origin` bra=`git config "branch.$r.merge" || echo "$r"` upstream="$rem/${bra#refs/heads/}" + if $fetchupstream; then + verbose git fetch "$rem" + fi if ! git rev-parse "$upstream" >/dev/null 2>&1; then upstream="origin/`repobranch "$d"`" fi @@ -961,7 +983,9 @@ case "$cmd" in fi if $killbranches; then git for-each-ref --format='%(refname)' refs/heads/ | while IFS= read -r B; do - git branch -D "${B#refs/heads/}" 2>/dev/null + if [ x"$B" != x"`git symbolic-ref HEAD`" ]; then + verbose git branch -D "${B#refs/heads/}" + fi done fi done