* [PATCH 0/2] git-pull: Allow --stat and --no-stat to be used with --rebase @ 2009-03-01 21:28 Tor Arne Vestbø 2009-03-01 21:28 ` [PATCH 1/2] git-rebase: Add --stat and --no-stat for producing diffstat on rebase Tor Arne Vestbø 0 siblings, 1 reply; 5+ messages in thread From: Tor Arne Vestbø @ 2009-03-01 21:28 UTC (permalink / raw) To: Junio C Hamano; +Cc: git These two small patches teach git-rebase to understand --stat, and git-pull to forward --stat to git-rebase when used with --rebase. Comments welcome! Tor Arne Vestbø (2): git-rebase: Add --stat and --no-stat for producing diffstat on rebase git-pull: Allow --stat and --no-stat to be used with --rebase Documentation/git-rebase.txt | 17 ++++++++++++++++- git-pull.sh | 10 +++++----- git-rebase.sh | 25 ++++++++++++++++++------- t/t3406-rebase-message.sh | 23 ++++++++++++++++++++++- 4 files changed, 61 insertions(+), 14 deletions(-) ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] git-rebase: Add --stat and --no-stat for producing diffstat on rebase 2009-03-01 21:28 [PATCH 0/2] git-pull: Allow --stat and --no-stat to be used with --rebase Tor Arne Vestbø @ 2009-03-01 21:28 ` Tor Arne Vestbø 2009-03-01 21:28 ` [PATCH 2/2] git-pull: Allow --stat and --no-stat to be used with --rebase Tor Arne Vestbø 2009-03-01 21:47 ` [PATCH 1/2] git-rebase: Add --stat and --no-stat for producing diffstat on rebase Jakub Narebski 0 siblings, 2 replies; 5+ messages in thread From: Tor Arne Vestbø @ 2009-03-01 21:28 UTC (permalink / raw) To: Junio C Hamano; +Cc: git The behavior of --verbose is unchanged, but uses a different state variable internally, so that the meaning of verbose output may be expanded without affecting the diffstat. This is also reflected in the documentation. The configuration option rebase.stat works the same was as merg.stat, but the default is currently false. Signed-off-by: Tor Arne Vestbø <torarnv@gmail.com> --- Documentation/git-rebase.txt | 17 ++++++++++++++++- git-rebase.sh | 25 ++++++++++++++++++------- t/t3406-rebase-message.sh | 23 ++++++++++++++++++++++- 3 files changed, 56 insertions(+), 9 deletions(-) diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index da3c38c..57bd333 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -192,6 +192,13 @@ Alternatively, you can undo the 'git-rebase' with git rebase --abort +CONFIGURATION +------------- + +rebase.stat:: + Whether to show a diffstat of what changed upstream since the last + rebase. False by default. + OPTIONS ------- <newbase>:: @@ -232,7 +239,15 @@ OPTIONS -v:: --verbose:: - Display a diffstat of what changed upstream since the last rebase. + Be verbose. Implies --stat. + +--stat:: + Show a diffstat of what changed upstream since the last rebase. The + diffstat is also controlled by the configuration option rebase.stat. + +-n:: +--no-stat:: + Do not show a diffstat as part of the rebase process. --no-verify:: This option bypasses the pre-rebase hook. See also linkgit:githooks[5]. diff --git a/git-rebase.sh b/git-rebase.sh index 368c0ef..26d7566 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -46,6 +46,7 @@ do_merge= dotest="$GIT_DIR"/rebase-merge prec=4 verbose= +diffstat=$(git config --bool rebase.stat) git_am_opt= rebase_root= @@ -289,8 +290,15 @@ do 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" @@ -426,18 +434,21 @@ then exit 0 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" diff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh index 5391080..85fc7c4 100755 --- a/t/t3406-rebase-message.sh +++ b/t/t3406-rebase-message.sh @@ -22,7 +22,8 @@ test_expect_success setup ' git checkout topic && quick_one A && quick_one B && - quick_one Z + quick_one Z && + git tag start ' @@ -41,4 +42,24 @@ test_expect_success 'rebase -m' ' ' +test_expect_success 'rebase --stat' ' + git reset --hard start + git rebase --stat master >diffstat.txt && + grep "^ fileX | *1 +$" diffstat.txt +' + +test_expect_success 'rebase w/config rebase.stat' ' + git reset --hard start + git config rebase.stat true && + git rebase master >diffstat.txt && + grep "^ fileX | *1 +$" diffstat.txt +' + +test_expect_success 'rebase -n overrides config rebase.stat config' ' + git reset --hard start + git config rebase.stat true && + git rebase -n master >diffstat.txt && + ! grep "^ fileX | *1 +$" diffstat.txt +' + test_done -- 1.6.2.rc2.11.g80931 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] git-pull: Allow --stat and --no-stat to be used with --rebase 2009-03-01 21:28 ` [PATCH 1/2] git-rebase: Add --stat and --no-stat for producing diffstat on rebase Tor Arne Vestbø @ 2009-03-01 21:28 ` Tor Arne Vestbø 2009-03-01 21:47 ` [PATCH 1/2] git-rebase: Add --stat and --no-stat for producing diffstat on rebase Jakub Narebski 1 sibling, 0 replies; 5+ messages in thread From: Tor Arne Vestbø @ 2009-03-01 21:28 UTC (permalink / raw) To: Junio C Hamano; +Cc: git Forwards the --stat, --no-stat, and --summary options on to git-rebase. Signed-off-by: Tor Arne Vestbø <torarnv@gmail.com> --- git-pull.sh | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/git-pull.sh b/git-pull.sh index 25adddf..8a26763 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -16,7 +16,7 @@ cd_to_toplevel test -z "$(git ls-files -u)" || die "You are in the middle of a conflicted merge." -strategy_args= no_stat= no_commit= squash= no_ff= log_arg= verbosity= +strategy_args= diffstat= no_commit= squash= no_ff= log_arg= verbosity= curr_branch=$(git symbolic-ref -q HEAD) curr_branch_short=$(echo "$curr_branch" | sed "s|refs/heads/||") rebase=$(git config --bool branch.$curr_branch_short.rebase) @@ -28,9 +28,9 @@ do -v|--verbose) verbosity="$verbosity -v" ;; -n|--no-stat|--no-summary) - no_stat=-n ;; + diffstat=--no-stat ;; --stat|--summary) - no_stat=$1 ;; + diffstat=--stat ;; --log|--no-log) log_arg=$1 ;; --no-c|--no-co|--no-com|--no-comm|--no-commi|--no-commit) @@ -188,7 +188,7 @@ fi merge_name=$(git fmt-merge-msg $log_arg <"$GIT_DIR/FETCH_HEAD") || exit test true = "$rebase" && - exec git-rebase $strategy_args --onto $merge_head \ + exec git-rebase $diffstat $strategy_args --onto $merge_head \ ${oldremoteref:-$merge_head} -exec git-merge $no_stat $no_commit $squash $no_ff $log_arg $strategy_args \ +exec git-merge $diffstat $no_commit $squash $no_ff $log_arg $strategy_args \ "$merge_name" HEAD $merge_head $verbosity -- 1.6.2.rc2.11.g80931 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] git-rebase: Add --stat and --no-stat for producing diffstat on rebase 2009-03-01 21:28 ` [PATCH 1/2] git-rebase: Add --stat and --no-stat for producing diffstat on rebase Tor Arne Vestbø 2009-03-01 21:28 ` [PATCH 2/2] git-pull: Allow --stat and --no-stat to be used with --rebase Tor Arne Vestbø @ 2009-03-01 21:47 ` Jakub Narebski 2009-03-01 22:11 ` [PATCH v2] " Tor Arne Vestbø 1 sibling, 1 reply; 5+ messages in thread From: Jakub Narebski @ 2009-03-01 21:47 UTC (permalink / raw) To: Tor Arne Vestbø; +Cc: git Tor Arne Vestbø <torarnv@gmail.com> writes: > The behavior of --verbose is unchanged, but uses a different state > variable internally, so that the meaning of verbose output may be > expanded without affecting the diffstat. This is also reflected in > the documentation. > > The configuration option rebase.stat works the same was as merg.stat, > but the default is currently false. > > Signed-off-by: Tor Arne Vestbø <torarnv@gmail.com> > --- > Documentation/git-rebase.txt | 17 ++++++++++++++++- > git-rebase.sh | 25 ++++++++++++++++++------- > t/t3406-rebase-message.sh | 23 ++++++++++++++++++++++- > 3 files changed, 56 insertions(+), 9 deletions(-) > You have to update also Documentation/config.txt -- Jakub Narebski Poland ShadeHawk on #git ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] git-rebase: Add --stat and --no-stat for producing diffstat on rebase 2009-03-01 21:47 ` [PATCH 1/2] git-rebase: Add --stat and --no-stat for producing diffstat on rebase Jakub Narebski @ 2009-03-01 22:11 ` Tor Arne Vestbø 0 siblings, 0 replies; 5+ messages in thread From: Tor Arne Vestbø @ 2009-03-01 22:11 UTC (permalink / raw) To: Junio C Hamano; +Cc: jnareb, git The behavior of --verbose is unchanged, but uses a different state variable internally, so that the meaning of verbose output may be expanded without affecting the diffstat. This is also reflected in the documentation. The configuration option rebase.stat works the same was as merg.stat, but the default is currently false. Signed-off-by: Tor Arne Vestbø <torarnv@gmail.com> --- Thanks Jakub, I knew there was a reason that git-config.txt was so empty ;) And sorry for the double post, --cc to git-send-email seems to override what's in the config, not compliment it. Documentation/config.txt | 4 ++++ Documentation/git-rebase.txt | 17 ++++++++++++++++- git-rebase.sh | 25 ++++++++++++++++++------- t/t3406-rebase-message.sh | 23 ++++++++++++++++++++++- 4 files changed, 60 insertions(+), 9 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index f5152c5..6be2e99 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -1160,6 +1160,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 --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index da3c38c..57bd333 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -192,6 +192,13 @@ Alternatively, you can undo the 'git-rebase' with git rebase --abort +CONFIGURATION +------------- + +rebase.stat:: + Whether to show a diffstat of what changed upstream since the last + rebase. False by default. + OPTIONS ------- <newbase>:: @@ -232,7 +239,15 @@ OPTIONS -v:: --verbose:: - Display a diffstat of what changed upstream since the last rebase. + Be verbose. Implies --stat. + +--stat:: + Show a diffstat of what changed upstream since the last rebase. The + diffstat is also controlled by the configuration option rebase.stat. + +-n:: +--no-stat:: + Do not show a diffstat as part of the rebase process. --no-verify:: This option bypasses the pre-rebase hook. See also linkgit:githooks[5]. diff --git a/git-rebase.sh b/git-rebase.sh index 368c0ef..26d7566 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -46,6 +46,7 @@ do_merge= dotest="$GIT_DIR"/rebase-merge prec=4 verbose= +diffstat=$(git config --bool rebase.stat) git_am_opt= rebase_root= @@ -289,8 +290,15 @@ do 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" @@ -426,18 +434,21 @@ then exit 0 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" diff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh index 5391080..85fc7c4 100755 --- a/t/t3406-rebase-message.sh +++ b/t/t3406-rebase-message.sh @@ -22,7 +22,8 @@ test_expect_success setup ' git checkout topic && quick_one A && quick_one B && - quick_one Z + quick_one Z && + git tag start ' @@ -41,4 +42,24 @@ test_expect_success 'rebase -m' ' ' +test_expect_success 'rebase --stat' ' + git reset --hard start + git rebase --stat master >diffstat.txt && + grep "^ fileX | *1 +$" diffstat.txt +' + +test_expect_success 'rebase w/config rebase.stat' ' + git reset --hard start + git config rebase.stat true && + git rebase master >diffstat.txt && + grep "^ fileX | *1 +$" diffstat.txt +' + +test_expect_success 'rebase -n overrides config rebase.stat config' ' + git reset --hard start + git config rebase.stat true && + git rebase -n master >diffstat.txt && + ! grep "^ fileX | *1 +$" diffstat.txt +' + test_done -- 1.6.2.rc2.11.g80931 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-03-01 22:10 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-03-01 21:28 [PATCH 0/2] git-pull: Allow --stat and --no-stat to be used with --rebase Tor Arne Vestbø 2009-03-01 21:28 ` [PATCH 1/2] git-rebase: Add --stat and --no-stat for producing diffstat on rebase Tor Arne Vestbø 2009-03-01 21:28 ` [PATCH 2/2] git-pull: Allow --stat and --no-stat to be used with --rebase Tor Arne Vestbø 2009-03-01 21:47 ` [PATCH 1/2] git-rebase: Add --stat and --no-stat for producing diffstat on rebase Jakub Narebski 2009-03-01 22:11 ` [PATCH v2] " Tor Arne Vestbø
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox