contrib / examples / git-whatchanged.shon commit Merge branch 'jk/error-resolve-conflict-advice' (d0d5ba7)
   1#!/bin/sh
   2
   3USAGE='[-p] [--max-count=<n>] [<since>..<limit>] [--pretty=<format>] [-m] [git-diff-tree options] [git-rev-list options]'
   4SUBDIRECTORY_OK='Yes'
   5. git-sh-setup
   6
   7diff_tree_flags=$(git-rev-parse --sq --no-revs --flags "$@") || exit
   8case "$0" in
   9*whatchanged)
  10        count=
  11        test -z "$diff_tree_flags" &&
  12                diff_tree_flags=$(git 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 config --get show.difftree)
  18        diff_tree_default_flags='--cc --always' ;;
  19esac
  20test -z "$diff_tree_flags" &&
  21        diff_tree_flags="$diff_tree_default_flags"
  22
  23rev_list_args=$(git-rev-parse --sq --default HEAD --revs-only "$@") &&
  24diff_tree_args=$(git-rev-parse --sq --no-revs --no-flags "$@") &&
  25
  26eval "git-rev-list $count $rev_list_args" |
  27eval "git-diff-tree --stdin --pretty -r $diff_tree_flags $diff_tree_args" |
  28LESS="$LESS -S" ${PAGER:-less}