From: Junio C Hamano Date: Thu, 2 Jul 2009 02:40:50 +0000 (-0700) Subject: Merge branch 'sb/quiet-porcelains' X-Git-Tag: v1.6.4-rc0~27 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/e6c7c2cc9766434607b8da5db872e7881a043925?ds=inline;hp=-c Merge branch 'sb/quiet-porcelains' * sb/quiet-porcelains: stash: teach quiet option am, rebase: teach quiet option submodule, repack: migrate to git-sh-setup's say() git-sh-setup: introduce say() for quiet options am: suppress apply errors when using 3-way t4150: test applying with a newline in subject --- e6c7c2cc9766434607b8da5db872e7881a043925 diff --combined git-rebase.sh index 334629fc97,84b5173f93..18bc6946cf --- a/git-rebase.sh +++ b/git-rebase.sh @@@ -3,7 -3,7 +3,7 @@@ # Copyright (c) 2005 Junio C Hamano. # - USAGE='[--interactive | -i] [-v] [--force-rebase | -f] [--onto ] [|--root] []' + USAGE='[--interactive | -i] [-v] [--force-rebase | -f] [--onto ] [|--root] [] [--quiet | -q]' LONG_USAGE='git-rebase replaces with a new branch of the same name. When the --onto option is provided the new branch starts out with a HEAD equal to , otherwise it is equal to @@@ -72,11 -72,20 +72,20 @@@ continue_merge () echo "directly, but instead do one of the following: " die "$RESOLVEMSG" fi - printf "Committed: %0${prec}d " $msgnum + if test -z "$GIT_QUIET" + then + printf "Committed: %0${prec}d " $msgnum + fi else - printf "Already applied: %0${prec}d " $msgnum + if test -z "$GIT_QUIET" + then + printf "Already applied: %0${prec}d " $msgnum + fi + fi + if test -z "$GIT_QUIET" + then + git rev-list --pretty=oneline -1 "$cmt" | sed -e 's/^[^ ]* //' fi - git rev-list --pretty=oneline -1 "$cmt" | sed -e 's/^[^ ]* //' prev_head=`git rev-parse HEAD^0` # save the resulting commit so we can read-tree on it later @@@ -97,6 -106,10 +106,10 @@@ call_merge () eval GITHEAD_$cmt='"${cmt_name##refs/heads/}~$(($end - $msgnum))"' eval GITHEAD_$hd='$(cat "$dotest/onto_name")' export GITHEAD_$cmt GITHEAD_$hd + if test -n "$GIT_QUIET" + then + export GIT_MERGE_VERBOSITY=1 + fi git-merge-$strategy "$cmt^" -- "$hd" "$cmt" rv=$? case "$rv" in @@@ -138,7 -151,7 +151,7 @@@ move_to_original_branch () finish_rb_merge () { move_to_original_branch rm -r "$dotest" - echo "All done." + say All done. } is_interactive () { @@@ -168,8 -181,10 +181,8 @@@ run_pre_rebase_hook () if test -z "$OK_TO_SKIP_PRE_REBASE" && test -x "$GIT_DIR/hooks/pre-rebase" then - "$GIT_DIR/hooks/pre-rebase" ${1+"$@"} || { - echo >&2 "The pre-rebase hook refused to rebase." - exit 1 - } + "$GIT_DIR/hooks/pre-rebase" ${1+"$@"} || + die "The pre-rebase hook refused to rebase." fi } @@@ -207,6 -222,7 +220,7 @@@ d end=$(cat "$dotest/end") msgnum=$(cat "$dotest/msgnum") onto=$(cat "$dotest/onto") + GIT_QUIET=$(cat "$dotest/quiet") continue_merge while test "$msgnum" -le "$end" do @@@ -219,6 -235,7 +233,7 @@@ head_name=$(cat "$GIT_DIR"/rebase-apply/head-name) && onto=$(cat "$GIT_DIR"/rebase-apply/onto) && orig_head=$(cat "$GIT_DIR"/rebase-apply/orig-head) && + GIT_QUIET=$(cat "$GIT_DIR"/rebase-apply/quiet) git am --resolved --3way --resolvemsg="$RESOLVEMSG" && move_to_original_branch exit @@@ -236,6 -253,7 +251,7 @@@ msgnum=$(cat "$dotest/msgnum") msgnum=$(($msgnum + 1)) onto=$(cat "$dotest/onto") + GIT_QUIET=$(cat "$dotest/quiet") while test "$msgnum" -le "$end" do call_merge "$msgnum" @@@ -247,6 -265,7 +263,7 @@@ head_name=$(cat "$GIT_DIR"/rebase-apply/head-name) && onto=$(cat "$GIT_DIR"/rebase-apply/onto) && orig_head=$(cat "$GIT_DIR"/rebase-apply/orig-head) && + GIT_QUIET=$(cat "$GIT_DIR"/rebase-apply/quiet) git am -3 --skip --resolvemsg="$RESOLVEMSG" && move_to_original_branch exit @@@ -258,9 -277,11 +275,11 @@@ git rerere clear if test -d "$dotest" then + GIT_QUIET=$(cat "$dotest/quiet") move_to_original_branch else dotest="$GIT_DIR"/rebase-apply + GIT_QUIET=$(cat "$dotest/quiet") move_to_original_branch fi git reset --hard $(cat "$dotest/orig-head") @@@ -298,6 -319,13 +317,13 @@@ -v|--verbose) verbose=t diffstat=t + GIT_QUIET= + ;; + -q|--quiet) + GIT_QUIET=t + git_am_opt="$git_am_opt -q" + verbose= + diffstat= ;; --whitespace=*) git_am_opt="$git_am_opt $1" @@@ -357,7 -385,8 +383,7 @@@ f # The tree must be really really clean. if ! git update-index --ignore-submodules --refresh; then - echo >&2 "cannot rebase: you have unstaged changes" - exit 1 + die "cannot rebase: you have unstaged changes" fi diff=$(git diff-index --cached --name-status -r --ignore-submodules HEAD --) case "$diff" in @@@ -442,15 -471,15 +468,15 @@@ the then # Lazily switch to the target branch if needed... test -z "$switch_to" || git checkout "$switch_to" - echo >&2 "Current branch $branch_name is up to date." + say "Current branch $branch_name is up to date." exit 0 else - echo "Current branch $branch_name is up to date, rebase forced." + say "Current branch $branch_name is up to date, rebase forced." fi fi # Detach HEAD and reset the tree - echo "First, rewinding head to replay your work on top of it..." + say "First, rewinding head to replay your work on top of it..." git checkout -q "$onto^0" || die "could not detach HEAD" git update-ref ORIG_HEAD $branch @@@ -468,7 -497,7 +494,7 @@@ f # we just fast forwarded. if test "$mb" = "$branch" then - echo >&2 "Fast-forwarded $branch_name to $onto_name." + say "Fast-forwarded $branch_name to $onto_name." move_to_original_branch exit 0 fi @@@ -490,7 -519,8 +516,8 @@@ the test 0 != $ret -a -d "$GIT_DIR"/rebase-apply && echo $head_name > "$GIT_DIR"/rebase-apply/head-name && echo $onto > "$GIT_DIR"/rebase-apply/onto && - echo $orig_head > "$GIT_DIR"/rebase-apply/orig-head + echo $orig_head > "$GIT_DIR"/rebase-apply/orig-head && + echo "$GIT_QUIET" > "$GIT_DIR"/rebase-apply/quiet exit $ret fi @@@ -504,6 -534,7 +531,7 @@@ prev_head=$orig_hea echo "$prev_head" > "$dotest/prev_head" echo "$orig_head" > "$dotest/orig-head" echo "$head_name" > "$dotest/head-name" + echo "$GIT_QUIET" > "$dotest/quiet" msgnum=0 for cmt in `git rev-list --reverse --no-merges "$revisions"` diff --combined git-submodule.sh index f4f3562671,58d2fd2ccb..ebed711da4 --- a/git-submodule.sh +++ b/git-submodule.sh @@@ -5,7 -5,7 +5,7 @@@ # Copyright (c) 2007 Lars Hjemli USAGE="[--quiet] [--cached] \ -[add [-b branch] ]|[status|init|update [-i|--init] [-N|--no-fetch]|summary [-n|--summary-limit ] []] \ +[add [-b branch] ]|[status|init|update [-i|--init] [-N|--no-fetch] [--rebase|--merge]|summary [-n|--summary-limit ] []] \ [--] [...]|[foreach ]|[sync [--] [...]]" OPTIONS_SPEC= . git-sh-setup @@@ -14,23 -14,11 +14,11 @@@ require_work_tre command= branch= - quiet= reference= cached= nofetch= update= - # - # print stuff on stdout unless -q was specified - # - say() - { - if test -z "$quiet" - then - echo "$@" - fi - } - # Resolve relative url by appending to parent's url resolve_relative_url () { @@@ -137,7 -125,7 +125,7 @@@ cmd_add( shift ;; -q|--quiet) - quiet=1 + GIT_QUIET=1 ;; --reference) case "$2" in '') usage ;; esac @@@ -273,7 -261,7 +261,7 @@@ cmd_init( do case "$1" in -q|--quiet) - quiet=1 + GIT_QUIET=1 ;; --) shift @@@ -333,7 -321,7 +321,7 @@@ cmd_update( case "$1" in -q|--quiet) shift - quiet=1 + GIT_QUIET=1 ;; -i|--init) init=1 @@@ -356,10 -344,6 +344,10 @@@ reference="$1" shift ;; + -m|--merge) + shift + update="merge" + ;; --) shift break @@@ -430,11 -414,6 +418,11 @@@ action="rebase" msg="rebased onto" ;; + merge) + command="git merge" + action="merge" + msg="merged in" + ;; *) command="git checkout $force -q" action="checkout" @@@ -659,7 -638,7 +647,7 @@@ cmd_status( do case "$1" in -q|--quiet) - quiet=1 + GIT_QUIET=1 ;; --cached) cached=1 @@@ -713,7 -692,7 +701,7 @@@ cmd_sync( do case "$1" in -q|--quiet) - quiet=1 + GIT_QUIET=1 shift ;; --) @@@ -768,7 -747,7 +756,7 @@@ d command=$1 ;; -q|--quiet) - quiet=1 + GIT_QUIET=1 ;; -b|--branch) case "$2" in