git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Implement rebase -q to fix pull --rebase -q

From
TATuncer Ayaz <tuncer.ayaz@gmail.com>
Date
Dec 3, 2008, 04:09 UTC
Message-ID
<4ac8254d0812022009t6eed5406ve2acb0b020240448@mail.gmail.com>
In-Reply-To
<1228277212-5917-1-git-send-email-tuncer.ayaz@gmail.com>
On Wed, Dec 3, 2008 at 5:06 AM, Tuncer Ayaz <tuncer.ayaz@gmail.com> wrote:
Show 79 quoted lines
> This is needed on top of the fetch/pull -q/-v changes
> to make
> $ git pull --rebase -q
> as quiet as expected.
>
> Signed-off-by: Tuncer Ayaz <tuncer.ayaz@gmail.com>
> ---
>  git-pull.sh   |    2 +-
>  git-rebase.sh |   31 +++++++++++++++++++++++--------
>  2 files changed, 24 insertions(+), 9 deletions(-)
>
> diff --git a/git-pull.sh b/git-pull.sh
> index 1cac898..57fcee9 100755
> --- a/git-pull.sh
> +++ b/git-pull.sh
> @@ -184,6 +184,6 @@ fi
>  merge_name=$(git fmt-merge-msg $log_arg <"$GIT_DIR/FETCH_HEAD") || exit
>  test true = "$rebase" &&
>        exec git-rebase $strategy_args --onto $merge_head \
> -       ${oldremoteref:-$merge_head}
> +       $verbosity ${oldremoteref:-$merge_head}
>  exec git-merge $no_stat $no_commit $squash $no_ff $log_arg $strategy_args \
>        "$merge_name" HEAD $merge_head $verbosity
> diff --git a/git-rebase.sh b/git-rebase.sh
> index 023a6dc..bbfdc2e 100755
> --- a/git-rebase.sh
> +++ b/git-rebase.sh
> @@ -3,7 +3,7 @@
>  # Copyright (c) 2005 Junio C Hamano.
>  #
>
> -USAGE='[--interactive | -i] [-v] [--onto <newbase>] <upstream> [<branch>]'
> +USAGE='[--interactive | -i] [-q] [-v] [--onto <newbase>] <upstream> [<branch>]'
>  LONG_USAGE='git-rebase replaces <branch> with a new branch of the
>  same name.  When the --onto option is provided the new branch starts
>  out with a HEAD equal to <newbase>, otherwise it is equal to <upstream>
> @@ -45,7 +45,7 @@ strategy=recursive
>  do_merge=
>  dotest="$GIT_DIR"/rebase-merge
>  prec=4
> -verbose=
> +verbosity=1
>  git_am_opt=
>
>  continue_merge () {
> @@ -135,7 +135,10 @@ move_to_original_branch () {
>  finish_rb_merge () {
>        move_to_original_branch
>        rm -r "$dotest"
> -       echo "All done."
> +       if test $verbosity -gt 0
> +       then
> +               echo "All done."
> +       fi
>  }
>
>  is_interactive () {
> @@ -288,8 +291,11 @@ do
>                esac
>                do_merge=t
>                ;;
> +       -q|--quiet)
> +               verbosity=0
> +               ;;
>        -v|--verbose)
> -               verbose=t
> +               verbosity=2
>                ;;
>        --whitespace=*)
>                git_am_opt="$git_am_opt $1"
> @@ -401,11 +407,14 @@ if test "$upstream" = "$onto" && test "$mb" = "$onto" &&
>  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."
> +       if test $verbosity -gt 0
> +       then
> +               echo >&2 "Current branch $branch_name is up to date."
> +       fi

If anyone dislikes the additional three lines I could combine the test with the action on one line. I'm just not sure that would make it better, especially depending on log message length.

Show 36 quoted lines
>        exit 0
>  fi
>
> -if test -n "$verbose"
> +if test $verbosity -gt 1
>  then
>        echo "Changes from $mb to $onto:"
>        # We want color (if set), but no pager
> @@ -413,7 +422,10 @@ then
>  fi
>
>  # Detach HEAD and reset the tree
> -echo "First, rewinding head to replay your work on top of it..."
> +if test $verbosity -gt 0
> +then
> +       echo "First, rewinding head to replay your work on top of it..."
> +fi
>  git checkout -q "$onto^0" || die "could not detach HEAD"
>  git update-ref ORIG_HEAD $branch
>
> @@ -421,7 +433,10 @@ git update-ref ORIG_HEAD $branch
>  # we just fast forwarded.
>  if test "$mb" = "$branch"
>  then
> -       echo >&2 "Fast-forwarded $branch_name to $onto_name."
> +       if test $verbosity -gt 0
> +       then
> +               echo >&2 "Fast-forwarded $branch_name to $onto_name."
> +       fi
>        move_to_original_branch
>        exit 0
>  fi
> --
> 1.6.0.2.GIT
>
>
Previous: Tuncer AyazNext: Junio C Hamano
Message 2 of 8 in “Implement rebase -q to fix pull --rebase -q”
  1. Implement rebase -q to fix pull --rebase -qTuncer Ayaz, Dec 3, 2008
  2. Tuncer AyazDec 3, 2008
  3. Junio C HamanoDec 3, 2008
  4. Tuncer AyazDec 3, 2008
  5. Junio C HamanoDec 3, 2008
  6. Tuncer AyazDec 3, 2008
  7. Junio C HamanoDec 3, 2008
  8. Tuncer AyazDec 3, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.