@matheusbsbs / matheus-bagliano / commits / 80d48ac623
Fork 0

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>

Junio C Hamano committed Feb 5, 2006 at 16:42 UTC 80d48ac6231d0d1c16d2b60a0c991d33bad797db
3 files changed +19 -5
.gitignore
+1
@@ -88,6 +88,7 @@ git-send-pack
88 git-sh-setup
89 git-shell
90 git-shortlog
91 +git-show
92 git-show-branch
93 git-show-index
94 git-ssh-fetch
Makefile
+4 -1
@@ -125,7 +125,7 @@ SCRIPT_PYTHON = \
125 SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
126 $(patsubst %.perl,%,$(SCRIPT_PERL)) \
127 $(patsubst %.py,%,$(SCRIPT_PYTHON)) \
128 - git-cherry-pick
128 + git-cherry-pick git-show
129
130 # The ones that do not have to link with lcrypto nor lz.
131 SIMPLE_PROGRAMS = \
@@ -440,6 +440,9 @@ $(patsubst %.py,%,$(SCRIPT_PYTHON)) : % : %.py
440 git-cherry-pick: git-revert
441 cp $< $@
442
443 +git-show: git-whatchanged
444 + cp $< $@
445 +
446 # These can record GIT_VERSION
447 git$X git.spec \
448 $(patsubst %.sh,%,$(SCRIPT_SH)) \
git-whatchanged.sh
+14 -4
@@ -5,14 +5,24 @@ SUBDIRECTORY_OK='Yes'
5 . git-sh-setup
6
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='-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" &&
9 - diff_tree_flags=$(git-repo-config --get whatchanged.difftree)
10 -test -z "$diff_tree_flags" &&
11 - diff_tree_flags='-M --abbrev'
21 + diff_tree_flags="$diff_tree_default_flags"
22
23 rev_list_args=$(git-rev-parse --sq --default HEAD --revs-only "$@") &&
24 diff_tree_args=$(git-rev-parse --sq --no-revs --no-flags "$@") &&
25
16 -eval "git-rev-list $rev_list_args" |
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}