[PATCH] whatchanged: customize diff-tree output
- From
Junio C Hamano <junkio@cox.net>
- Date
- Dec 22, 2005, 06:21 UTC
- Message-ID
- <7vvexhr6rc.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <Pine.LNX.4.63.0512212336230.18908@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 6 quoted lines
> The output is much nicer on standard 80 columns. If you want the old > behaviour, you can still do > > git-whatchanged --abbrev=40 > > Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
You already know I am in favor of this; it was the motivation behind --abbrev. With an 80-column terminal, especially with the hardcoded LESS=-S switch, the default diff-raw output was unusable.
How about doing something like this patch first, and then decide what the default should be?
I would recommend "--pretty -r --name-status -M" as the default. But I am not particularly interested in imposing my preference over that of Linus to the end users.
-- >8 -- This allows the configuration item whatchanged.difftree to control the output from git-whatchanged command. For example:
[whatchanged]
difftree = --pretty=fuller --name-status -Mdoes rename detection, shows the commit header in "fuller" format and lists modified pathnames with the kind of change instead of the default hash pairs.
Not having the configuration item is the same as the original output format (--pretty -r).
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/git-whatchanged.sh b/git-whatchanged.sh index b170f74..b651b3f 100755 --- a/git-whatchanged.sh +++ b/git-whatchanged.sh @@ -4,9 +4,15 @@ USAGE='[-p] [--max-count=<n>] [<since>.. SUBDIRECTORY_OK='Yes' . git-sh-setup +diff_tree_flags=$(git-rev-parse --sq --no-revs --flags "$@") +test -z "$diff_tree_flags" && + diff_tree_flags=$(git-repo-config --get whatchanged.difftree) +test -z "$diff_tree_flags" && + diff_tree_flags='' # NEW DEFAULT HERE + rev_list_args=$(git-rev-parse --sq --default HEAD --revs-only "$@") && -diff_tree_args=$(git-rev-parse --sq --no-revs "$@") && +diff_tree_args=$(git-rev-parse --sq --no-revs --no-flags "$@") && eval "git-rev-list $rev_list_args" | -eval "git-diff-tree --stdin --pretty -r $diff_tree_args" | +eval "git-diff-tree --stdin --pretty -r $diff_tree_flags $diff_tree_args" | LESS="$LESS -S" ${PAGER:-less}