Skip to content

Commit

Permalink
whatchanged: customize diff-tree output
Browse files Browse the repository at this point in the history
This allows the configuration item whatchanged.difftree to
control the output from git-whatchanged command.  For example:

	[whatchanged]
        	difftree = --pretty=fuller --name-status -M

does rename detection, shows the commit header in "fuller"
format and lists affected pathnames and the kind of changes to
them.

When no such configuration item exists, the output format
defaults to "--pretty -M --abbrev".

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Dec 22, 2005
1 parent ebc12ce commit 9b15770
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions git-whatchanged.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ USAGE='[-p] [--max-count=<n>] [<since>..<limit>] [--pretty=<format>] [-m] [git-d
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='-M --abbrev'

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}

0 comments on commit 9b15770

Please sign in to comment.