aboutsummaryrefslogtreecommitdiff
path: root/git-whatchanged.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-02-05 16:42:49 -0800
committerJunio C Hamano <junkio@cox.net>2006-02-05 16:42:49 -0800
commit80d48ac6231d0d1c16d2b60a0c991d33bad797db (patch)
treee40d05682537e69ea77e89a6ac6a1dd5ef504ee6 /git-whatchanged.sh
parentdf9892ffce46d1f1bd6fe64aa445be2ffe7346cf (diff)
downloadgit-80d48ac6231d0d1c16d2b60a0c991d33bad797db.tar.gz
git-80d48ac6231d0d1c16d2b60a0c991d33bad797db.tar.xz
git-show
This is essentially 'git whatchanged -n1 --always --cc "$@"'. Just like whatchanged takes default flags from whatchanged.difftree configuration, this uses show.difftree configuration. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-whatchanged.sh')
-rwxr-xr-xgit-whatchanged.sh18
1 files changed, 14 insertions, 4 deletions
diff --git a/git-whatchanged.sh b/git-whatchanged.sh
index d4f985b5e..574fc3558 100755
--- a/git-whatchanged.sh
+++ b/git-whatchanged.sh
@@ -5,14 +5,24 @@ SUBDIRECTORY_OK='Yes'
. git-sh-setup
diff_tree_flags=$(git-rev-parse --sq --no-revs --flags "$@") || exit
+case "$0" in
+*whatchanged)
+ count=
+ test -z "$diff_tree_flags" &&
+ diff_tree_flags=$(git-repo-config --get whatchanged.difftree)
+ diff_tree_default_flags='-M --abbrev' ;;
+*show)
+ count=-n1
+ test -z "$diff_tree_flags" &&
+ diff_tree_flags=$(git-repo-config --get show.difftree)
+ diff_tree_default_flags='--cc --always' ;;
+esac
test -z "$diff_tree_flags" &&
- diff_tree_flags=$(git-repo-config --get whatchanged.difftree)
-test -z "$diff_tree_flags" &&
- diff_tree_flags='-M --abbrev'
+ diff_tree_flags="$diff_tree_default_flags"
rev_list_args=$(git-rev-parse --sq --default HEAD --revs-only "$@") &&
diff_tree_args=$(git-rev-parse --sq --no-revs --no-flags "$@") &&
-eval "git-rev-list $rev_list_args" |
+eval "git-rev-list $count $rev_list_args" |
eval "git-diff-tree --stdin --pretty -r $diff_tree_flags $diff_tree_args" |
LESS="$LESS -S" ${PAGER:-less}