Clean up trailing whitespace when pretty-printing commits
[git/spearce.git] / git-whatchanged.sh
blob1fb9feb34849f5030d0b9dc7f91ae65e22322786
1 #!/bin/sh
3 USAGE='[-p] [--max-count=<n>] [<since>..<limit>] [--pretty=<format>] [-m] [git-diff-tree options] [git-rev-list options]'
4 SUBDIRECTORY_OK='Yes'
5 . git-sh-setup
7 diff_tree_flags=$(git-rev-parse --sq --no-revs --flags "$@") || exit
8 case "$0" in
9 *whatchanged)
10 count=
11 test -z "$diff_tree_flags" &&
12 diff_tree_flags=$(git-repo-config --get whatchanged.difftree)
13 diff_tree_default_flags='-c -M --abbrev' ;;
14 *show)
15 count=-n1
16 test -z "$diff_tree_flags" &&
17 diff_tree_flags=$(git-repo-config --get show.difftree)
18 diff_tree_default_flags='--cc --always' ;;
19 esac
20 test -z "$diff_tree_flags" &&
21 diff_tree_flags="$diff_tree_default_flags"
23 rev_list_args=$(git-rev-parse --sq --default HEAD --revs-only "$@") &&
24 diff_tree_args=$(git-rev-parse --sq --no-revs --no-flags "$@") &&
26 eval "git-rev-list $count $rev_list_args" |
27 eval "git-diff-tree --stdin --pretty -r $diff_tree_flags $diff_tree_args" |
28 LESS="$LESS -S" ${PAGER:-less}