Merge branch 'tv/rebase-stat'
authorJunio C Hamano <gitster@pobox.com>
Wed, 11 Mar 2009 20:49:11 +0000 (13:49 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 11 Mar 2009 20:49:11 +0000 (13:49 -0700)
* tv/rebase-stat:
git-pull: Allow --stat and --no-stat to be used with --rebase
git-rebase: Add --stat and --no-stat for producing diffstat on rebase

1  2 
Documentation/config.txt
git-rebase.sh
diff --combined Documentation/config.txt
index 300ab25dcf61569d3649a279fabad05e78795421,6be2e9935b7cb9a885caebdb22f051d912715769..56bd781a163d70ce23f1b6932ce3b1c70510d3b5
@@@ -677,16 -677,6 +677,16 @@@ format.pretty:
        See linkgit:git-log[1], linkgit:git-show[1],
        linkgit:git-whatchanged[1].
  
 +format.thread::
 +      The default threading style for 'git-format-patch'.  Can be
 +      either a boolean value, `shallow` or `deep`.  'Shallow'
 +      threading makes every mail a reply to the head of the series,
 +      where the head is chosen from the cover letter, the
 +      `\--in-reply-to`, and the first patch mail, in this order.
 +      'Deep' threading makes every mail a reply to the previous one.
 +      A true boolean value is the same as `shallow`, and a false
 +      value disables threading.
 +
  gc.aggressiveWindow::
        The window size parameter used in the delta compression
        algorithm used by 'git-gc --aggressive'.  This defaults
@@@ -1170,6 -1160,10 +1170,10 @@@ pull.octopus:
  pull.twohead::
        The default merge strategy to use when pulling a single branch.
  
+ rebase.stat::
+       Whether to show a diffstat of what changed upstream since the last
+       rebase. False by default.
  receive.fsckObjects::
        If it is set to true, git-receive-pack will check all received
        objects. It will abort in the case of a malformed object or a
diff --combined git-rebase.sh
index c2a9b1fbe05499af32d25750498b244bc0597592,26d75662f915661dd2f87477fca1c00443d6aa2f..d38ab0b83fd46e4b3f7c0e81bc97a4b313925786
@@@ -3,7 -3,7 +3,7 @@@
  # Copyright (c) 2005 Junio C Hamano.
  #
  
 -USAGE='[--interactive | -i] [-v] [--onto <newbase>] [<upstream>|--root] [<branch>]'
 +USAGE='[--interactive | -i] [-v] [--force-rebase | -f] [--onto <newbase>] [<upstream>|--root] [<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>
@@@ -46,9 -46,9 +46,10 @@@ do_merge
  dotest="$GIT_DIR"/rebase-merge
  prec=4
  verbose=
+ diffstat=$(git config --bool rebase.stat)
  git_am_opt=
  rebase_root=
 +force_rebase=
  
  continue_merge () {
        test -n "$prev_head" || die "prev_head must be defined"
                esac
                do_merge=t
                ;;
+       -n|--no-stat)
+               diffstat=
+               ;;
+       --stat)
+               diffstat=t
+               ;;
        -v|--verbose)
                verbose=t
+               diffstat=t
                ;;
        --whitespace=*)
                git_am_opt="$git_am_opt $1"
 +              case "$1" in
 +              --whitespace=fix|--whitespace=strip)
 +                      force_rebase=t
 +                      ;;
 +              esac
                ;;
        -C*)
                git_am_opt="$git_am_opt $1"
        --root)
                rebase_root=t
                ;;
 +      -f|--f|--fo|--for|--forc|force|--force-r|--force-re|--force-reb|--force-reba|--force_rebas|--force-rebase)
 +              force_rebase=t
 +              ;;
        -*)
                usage
                ;;
@@@ -429,29 -428,27 +437,32 @@@ if test "$upstream" = "$onto" && test "
        # linear history?
        ! (git rev-list --parents "$onto".."$branch" | grep " .* ") > /dev/null
  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."
 -      exit 0
 +      if test -z "$force_rebase"
 +      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."
 +              exit 0
 +      else
 +              echo "Current branch $branch_name is up to date, rebase forced."
 +      fi
  fi
  
- if test -n "$verbose"
- then
-       echo "Changes from $mb to $onto:"
-       # We want color (if set), but no pager
-       GIT_PAGER='' git diff --stat --summary "$mb" "$onto"
- fi
  # Detach HEAD and reset the tree
  echo "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
  
+ if test -n "$diffstat"
+ then
+       if test -n "$verbose"
+       then
+               echo "Changes from $mb to $onto:"
+       fi
+       # We want color (if set), but no pager
+       GIT_PAGER='' git diff --stat --summary "$mb" "$onto"
+ fi
  # If the $onto is a proper descendant of the tip of the branch, then
  # we just fast forwarded.
  if test "$mb" = "$branch"