File tree Expand file tree Collapse file tree 5 files changed +65
-14
lines changed
Expand file tree Collapse file tree 5 files changed +65
-14
lines changed Original file line number Diff line number Diff line change @@ -1170,6 +1170,10 @@ pull.octopus::
11701170pull.twohead::
11711171 The default merge strategy to use when pulling a single branch.
11721172
1173+ rebase.stat::
1174+ Whether to show a diffstat of what changed upstream since the last
1175+ rebase. False by default.
1176+
11731177receive.fsckObjects::
11741178 If it is set to true, git-receive-pack will check all received
11751179 objects. It will abort in the case of a malformed object or a
Original file line number Diff line number Diff line change @@ -192,6 +192,13 @@ Alternatively, you can undo the 'git-rebase' with
192192
193193 git rebase --abort
194194
195+ CONFIGURATION
196+ -------------
197+
198+ rebase.stat::
199+ Whether to show a diffstat of what changed upstream since the last
200+ rebase. False by default.
201+
195202OPTIONS
196203-------
197204<newbase>::
@@ -232,7 +239,15 @@ OPTIONS
232239
233240-v::
234241--verbose::
235- Display a diffstat of what changed upstream since the last rebase.
242+ Be verbose. Implies --stat.
243+
244+ --stat::
245+ Show a diffstat of what changed upstream since the last rebase. The
246+ diffstat is also controlled by the configuration option rebase.stat.
247+
248+ -n::
249+ --no-stat::
250+ Do not show a diffstat as part of the rebase process.
236251
237252--no-verify::
238253 This option bypasses the pre-rebase hook. See also linkgit:githooks[5].
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ cd_to_toplevel
1616test -z " $( git ls-files -u) " ||
1717 die " You are in the middle of a conflicted merge."
1818
19- strategy_args= no_stat = no_commit= squash= no_ff= log_arg= verbosity=
19+ strategy_args= diffstat = no_commit= squash= no_ff= log_arg= verbosity=
2020curr_branch=$( git symbolic-ref -q HEAD)
2121curr_branch_short=$( echo " $curr_branch " | sed " s|refs/heads/||" )
2222rebase=$( git config --bool branch.$curr_branch_short .rebase)
2828 -v|--verbose)
2929 verbosity=" $verbosity -v" ;;
3030 -n|--no-stat|--no-summary)
31- no_stat=-n ;;
31+ diffstat=--no-stat ;;
3232 --stat|--summary)
33- no_stat= $1 ;;
33+ diffstat=--stat ;;
3434 --log|--no-log)
3535 log_arg=$1 ;;
3636 --no-c|--no-co|--no-com|--no-comm|--no-commi|--no-commit)
188188
189189merge_name=$( git fmt-merge-msg $log_arg < " $GIT_DIR /FETCH_HEAD" ) || exit
190190test true = " $rebase " &&
191- exec git-rebase $strategy_args --onto $merge_head \
191+ exec git-rebase $diffstat $ strategy_args --onto $merge_head \
192192 ${oldremoteref:- $merge_head }
193- exec git-merge $no_stat $no_commit $squash $no_ff $log_arg $strategy_args \
193+ exec git-merge $diffstat $no_commit $squash $no_ff $log_arg $strategy_args \
194194 " $merge_name " HEAD $merge_head $verbosity
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ do_merge=
4646dotest=" $GIT_DIR " /rebase-merge
4747prec=4
4848verbose=
49+ diffstat=$( git config --bool rebase.stat)
4950git_am_opt=
5051rebase_root=
5152force_rebase=
290291 esac
291292 do_merge=t
292293 ;;
294+ -n|--no-stat)
295+ diffstat=
296+ ;;
297+ --stat)
298+ diffstat=t
299+ ;;
293300 -v|--verbose)
294301 verbose=t
302+ diffstat=t
295303 ;;
296304 --whitespace=* )
297305 git_am_opt=" $git_am_opt $1 "
@@ -440,18 +448,21 @@ then
440448 fi
441449fi
442450
443- if test -n " $verbose "
444- then
445- echo " Changes from $mb to $onto :"
446- # We want color (if set), but no pager
447- GIT_PAGER=' ' git diff --stat --summary " $mb " " $onto "
448- fi
449-
450451# Detach HEAD and reset the tree
451452echo " First, rewinding head to replay your work on top of it..."
452453git checkout -q " $onto ^0" || die " could not detach HEAD"
453454git update-ref ORIG_HEAD $branch
454455
456+ if test -n " $diffstat "
457+ then
458+ if test -n " $verbose "
459+ then
460+ echo " Changes from $mb to $onto :"
461+ fi
462+ # We want color (if set), but no pager
463+ GIT_PAGER=' ' git diff --stat --summary " $mb " " $onto "
464+ fi
465+
455466# If the $onto is a proper descendant of the tip of the branch, then
456467# we just fast forwarded.
457468if test " $mb " = " $branch "
Original file line number Diff line number Diff line change @@ -22,7 +22,8 @@ test_expect_success setup '
2222 git checkout topic &&
2323 quick_one A &&
2424 quick_one B &&
25- quick_one Z
25+ quick_one Z &&
26+ git tag start
2627
2728'
2829
@@ -41,4 +42,24 @@ test_expect_success 'rebase -m' '
4142
4243'
4344
45+ test_expect_success ' rebase --stat' '
46+ git reset --hard start
47+ git rebase --stat master >diffstat.txt &&
48+ grep "^ fileX | *1 +$" diffstat.txt
49+ '
50+
51+ test_expect_success ' rebase w/config rebase.stat' '
52+ git reset --hard start
53+ git config rebase.stat true &&
54+ git rebase master >diffstat.txt &&
55+ grep "^ fileX | *1 +$" diffstat.txt
56+ '
57+
58+ test_expect_success ' rebase -n overrides config rebase.stat config' '
59+ git reset --hard start
60+ git config rebase.stat true &&
61+ git rebase -n master >diffstat.txt &&
62+ ! grep "^ fileX | *1 +$" diffstat.txt
63+ '
64+
4465test_done
You can’t perform that action at this time.
0 commit comments