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 <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Alex Riesen committed
May 23, 2007 at 23:01 UTC
51e7ecf4ecb506fb36cd5933cb7b78fb4b315ac9
4 files changed
+20
-7
Documentation/git-merge.txt
+1
-1
@@ -9,7 +9,7 @@ git-merge - Join two or more development histories together
9
SYNOPSIS
10
--------
11
[verse]
12
-'git-merge' [-n] [--no-commit] [--squash] [-s <strategy>]...
12
+'git-merge' [-n] [--summary] [--no-commit] [--squash] [-s <strategy>]...
13
[-m <msg>] <remote> <remote>...
14
15
DESCRIPTION
Documentation/merge-options.txt
+4
@@ -1,3 +1,7 @@
1
+--summary::
2
+ Show a diffstat at the end of the merge. The diffstat is also
3
+ controlled by the configuration option merge.diffstat.
4
+
5
-n, \--no-summary::
6
Do not show diffstat at the end of the merge.
7
git-merge.sh
+12
-6
@@ -3,7 +3,7 @@
3
# Copyright (c) 2005 Junio C Hamano
4
#
5
6
-USAGE='[-n] [--no-commit] [--squash] [-s <strategy>] [-m=<merge-message>] <commit>+'
6
+USAGE='[-n] [--summary] [--no-commit] [--squash] [-s <strategy>] [-m=<merge-message>] <commit>+'
7
8
SUBDIRECTORY_OK=Yes
9
. git-sh-setup
@@ -88,12 +88,11 @@ finish () {
88
'')
89
;;
90
?*)
91
- case "$no_summary" in
92
- '')
91
+ if test "$show_diffstat" = t
92
+ then
93
# We want color (if set), but no pager
94
GIT_PAGER='' git-diff --stat --summary -M "$head" "$1"
95
- ;;
96
- esac
95
+ fi
96
;;
97
esac
98
}
@@ -126,7 +125,9 @@ do
125
case "$1" in
126
-n|--n|--no|--no-|--no-s|--no-su|--no-sum|--no-summ|\
127
--no-summa|--no-summar|--no-summary)
129
- no_summary=t ;;
128
+ show_diffstat=false ;;
129
+ --summary)
130
+ show_diffstat=t ;;
131
--sq|--squ|--squa|--squas|--squash)
132
squash=t no_commit=t ;;
133
--no-c|--no-co|--no-com|--no-comm|--no-commi|--no-commit)
@@ -168,6 +169,11 @@ do
169
shift
170
done
171
172
+if test -z "$show_diffstat"; then
173
+ test "$(git-config --bool merge.diffstat)" = false && show_diffstat=false
174
+ test -z "$show_diffstat" && show_diffstat=t
175
+fi
176
+
177
# This could be traditional "merge <msg> HEAD <commit>..." and the
178
# way we can tell it is to see if the second token is HEAD, but some
179
# people might have misused the interface and used a committish that
git-pull.sh
+3
@@ -22,6 +22,9 @@ do
22
-n|--n|--no|--no-|--no-s|--no-su|--no-sum|--no-summ|\
23
--no-summa|--no-summar|--no-summary)
24
no_summary=-n ;;
25
+ --summary)
26
+ no_summary=$1
27
+ ;;
28
--no-c|--no-co|--no-com|--no-comm|--no-commi|--no-commit)
29
no_commit=--no-commit ;;
30
--sq|--squ|--squa|--squas|--squash)