merge, pull: introduce '--(no-)stat' option
This option has the same effect as '--(no-)summary' (i.e. whether to show a diffsat at the end of the merge or not), and it is consistent with the '--stat' option of other git commands. Documentation, tests, and bash completion are updaed accordingly, and the old --summary option is marked as being deprected. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor committed
Apr 6, 2008 at 03:23 UTC
d8abe148bece83f6c3e5ebe6075aef236322ed74
6 files changed
+40
-21
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] [--summary] [--no-commit] [--squash] [-s <strategy>]...
12
+'git-merge' [-n] [--stat] [--no-commit] [--squash] [-s <strategy>]...
13
[-m <msg>] <remote> <remote>...
14
'git-merge' <msg> HEAD <remote>...
15
Documentation/merge-options.txt
+6
-2
@@ -1,10 +1,14 @@
1
---summary::
1
+--stat::
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::
5
+-n, \--no-stat::
6
Do not show diffstat at the end of the merge.
7
8
+--summary, \--no-summary::
9
+ Synonyms to --stat and --no-stat; these are deprecated and will be
10
+ removed in the future.
11
+
12
--no-commit::
13
Perform the merge but pretend the merge failed and do
14
not autocommit, to give the user a chance to inspect and
contrib/completion/git-completion.bash
+1
-1
@@ -779,7 +779,7 @@ _git_merge ()
779
;;
780
--*)
781
__gitcomp "
782
- --no-commit --no-summary --squash --strategy
782
+ --no-commit --no-stat --squash --strategy
783
"
784
return
785
esac
git-merge.sh
+6
-4
@@ -8,8 +8,10 @@ OPTIONS_SPEC="\
8
git-merge [options] <remote>...
9
git-merge [options] <msg> HEAD <remote>
10
--
11
-summary show a diffstat at the end of the merge
12
-n,no-summary don't show a diffstat at the end of the merge
11
+stat show a diffstat at the end of the merge
12
+n,no-stat don't show a diffstat at the end of the merge
13
+summary (synonym to --stat)
14
+no-summary (synonym to --no-stat)
15
squash create a single commit instead of doing a merge
16
commit perform a commit if the merge sucesses (default)
17
ff allow fast forward (default)
@@ -148,9 +150,9 @@ merge_name () {
150
parse_config () {
151
while test $# != 0; do
152
case "$1" in
151
- -n|--no-summary)
153
+ -n|--no-stat|--no-summary)
154
show_diffstat=false ;;
153
- --summary)
155
+ --stat|--summary)
156
show_diffstat=t ;;
157
--squash)
158
test "$allow_fast_forward" = t ||
git-pull.sh
+7
-9
@@ -4,7 +4,7 @@
4
#
5
# Fetch one or more remote refs and merge it/them into the current HEAD.
6
7
-USAGE='[-n | --no-summary] [--[no-]commit] [--[no-]squash] [--[no-]ff] [-s strategy]... [<fetch-options>] <repo> <head>...'
7
+USAGE='[-n | --no-stat] [--[no-]commit] [--[no-]squash] [--[no-]ff] [-s strategy]... [<fetch-options>] <repo> <head>...'
8
LONG_USAGE='Fetch one or more remote refs and merge it/them into the current HEAD.'
9
SUBDIRECTORY_OK=Yes
10
OPTIONS_SPEC=
@@ -16,19 +16,17 @@ cd_to_toplevel
16
test -z "$(git ls-files -u)" ||
17
die "You are in the middle of a conflicted merge."
18
19
-strategy_args= no_summary= no_commit= squash= no_ff=
19
+strategy_args= no_stat= no_commit= squash= no_ff=
20
curr_branch=$(git symbolic-ref -q HEAD)
21
curr_branch_short=$(echo "$curr_branch" | sed "s|refs/heads/||")
22
rebase=$(git config --bool branch.$curr_branch_short.rebase)
23
while :
24
do
25
case "$1" in
26
- -n|--n|--no|--no-|--no-s|--no-su|--no-sum|--no-summ|\
27
- --no-summa|--no-summar|--no-summary)
28
- no_summary=-n ;;
29
- --summary)
30
- no_summary=$1
31
- ;;
26
+ -n|--no-stat|--no-summary)
27
+ no_stat=-n ;;
28
+ --stat|--summary)
29
+ no_stat=$1 ;;
30
--no-c|--no-co|--no-com|--no-comm|--no-commi|--no-commit)
31
no_commit=--no-commit ;;
32
--c|--co|--com|--comm|--commi|--commit)
@@ -176,5 +174,5 @@ merge_name=$(git fmt-merge-msg <"$GIT_DIR/FETCH_HEAD") || exit
174
test true = "$rebase" &&
175
exec git-rebase $strategy_args --onto $merge_head \
176
${oldremoteref:-$merge_head}
179
-exec git-merge $no_summary $no_commit $squash $no_ff $strategy_args \
177
+exec git-merge $no_stat $no_commit $squash $no_ff $strategy_args \
178
"$merge_name" HEAD $merge_head
t/t7600-merge.sh
+19
-4
@@ -364,7 +364,7 @@ test_expect_success 'merge c1 with c2 (squash in config)' '
364
365
test_debug 'gitk --all'
366
367
-test_expect_success 'override config option -n' '
367
+test_expect_success 'override config option -n with --summary' '
368
git reset --hard c1 &&
369
git config branch.master.mergeoptions "-n" &&
370
test_tick &&
@@ -373,15 +373,30 @@ test_expect_success 'override config option -n' '
373
verify_parents $c1 $c2 &&
374
if ! grep "^ file | *2 +-$" diffstat.txt
375
then
376
- echo "[OOPS] diffstat was not generated"
376
+ echo "[OOPS] diffstat was not generated with --summary"
377
+ false
378
+ fi
379
+'
380
+
381
+test_expect_success 'override config option -n with --stat' '
382
+ git reset --hard c1 &&
383
+ git config branch.master.mergeoptions "-n" &&
384
+ test_tick &&
385
+ git merge --stat c2 >diffstat.txt &&
386
+ verify_merge file result.1-5 msg.1-5 &&
387
+ verify_parents $c1 $c2 &&
388
+ if ! grep "^ file | *2 +-$" diffstat.txt
389
+ then
390
+ echo "[OOPS] diffstat was not generated with --stat"
391
+ false
392
fi
393
'
394
395
test_debug 'gitk --all'
396
382
-test_expect_success 'override config option --summary' '
397
+test_expect_success 'override config option --stat' '
398
git reset --hard c1 &&
384
- git config branch.master.mergeoptions "--summary" &&
399
+ git config branch.master.mergeoptions "--stat" &&
400
test_tick &&
401
git merge -n c2 >diffstat.txt &&
402
verify_merge file result.1-5 msg.1-5 &&