From: Alex Riesen Date: Wed, 23 May 2007 21:01:29 +0000 (+0200) Subject: Add a configuration option to control diffstat after merge X-Git-Tag: v1.5.3-rc0~187^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=51e7ecf4ecb506fb36cd5933cb7b78fb4b315ac9;p=git.git Add a configuration option to control diffstat after merge The diffstat can be controlled either with command-line options (--summary|--no-summary) or with merge.diffstat. The default is left as it was: diffstat is active by default. Signed-off-by: Alex Riesen Signed-off-by: Junio C Hamano --- diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt index 9c08efa53..912ef29ef 100644 --- a/Documentation/git-merge.txt +++ b/Documentation/git-merge.txt @@ -9,7 +9,7 @@ git-merge - Join two or more development histories together SYNOPSIS -------- [verse] -'git-merge' [-n] [--no-commit] [--squash] [-s ]... +'git-merge' [-n] [--summary] [--no-commit] [--squash] [-s ]... [-m ] ... DESCRIPTION diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt index 182cef54b..56f1d8d69 100644 --- a/Documentation/merge-options.txt +++ b/Documentation/merge-options.txt @@ -1,3 +1,7 @@ +--summary:: + Show a diffstat at the end of the merge. The diffstat is also + controlled by the configuration option merge.diffstat. + -n, \--no-summary:: Do not show diffstat at the end of the merge. diff --git a/git-merge.sh b/git-merge.sh index 351676f6d..44e9b70a6 100755 --- a/git-merge.sh +++ b/git-merge.sh @@ -3,7 +3,7 @@ # Copyright (c) 2005 Junio C Hamano # -USAGE='[-n] [--no-commit] [--squash] [-s ] [-m=] +' +USAGE='[-n] [--summary] [--no-commit] [--squash] [-s ] [-m=] +' SUBDIRECTORY_OK=Yes . git-sh-setup @@ -88,12 +88,11 @@ finish () { '') ;; ?*) - case "$no_summary" in - '') + if test "$show_diffstat" = t + then # We want color (if set), but no pager GIT_PAGER='' git-diff --stat --summary -M "$head" "$1" - ;; - esac + fi ;; esac } @@ -126,7 +125,9 @@ do case "$1" in -n|--n|--no|--no-|--no-s|--no-su|--no-sum|--no-summ|\ --no-summa|--no-summar|--no-summary) - no_summary=t ;; + show_diffstat=false ;; + --summary) + show_diffstat=t ;; --sq|--squ|--squa|--squas|--squash) squash=t no_commit=t ;; --no-c|--no-co|--no-com|--no-comm|--no-commi|--no-commit) @@ -168,6 +169,11 @@ do shift done +if test -z "$show_diffstat"; then + test "$(git-config --bool merge.diffstat)" = false && show_diffstat=false + test -z "$show_diffstat" && show_diffstat=t +fi + # This could be traditional "merge HEAD ..." and the # way we can tell it is to see if the second token is HEAD, but some # people might have misused the interface and used a committish that diff --git a/git-pull.sh b/git-pull.sh index a3665d775..ba0ca079e 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -22,6 +22,9 @@ do -n|--n|--no|--no-|--no-s|--no-su|--no-sum|--no-summ|\ --no-summa|--no-summar|--no-summary) no_summary=-n ;; + --summary) + no_summary=$1 + ;; --no-c|--no-co|--no-com|--no-comm|--no-commi|--no-commit) no_commit=--no-commit ;; --sq|--squ|--squa|--squas|--squash)