2005-05-17 20:47:13 +02:00
|
|
|
#!/bin/sh
|
2005-12-15 23:48:38 +01:00
|
|
|
|
|
|
|
USAGE='[-p] [--max-count=<n>] [<since>..<limit>] [--pretty=<format>] [-m] [git-diff-tree options] [git-rev-list options]'
|
|
|
|
SUBDIRECTORY_OK='Yes'
|
|
|
|
. git-sh-setup
|
|
|
|
|
2006-01-25 23:02:10 +01:00
|
|
|
diff_tree_flags=$(git-rev-parse --sq --no-revs --flags "$@") || exit
|
2006-02-06 01:42:49 +01:00
|
|
|
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
|
2005-12-22 07:25:00 +01:00
|
|
|
test -z "$diff_tree_flags" &&
|
2006-02-06 01:42:49 +01:00
|
|
|
diff_tree_flags="$diff_tree_default_flags"
|
2005-12-22 07:25:00 +01:00
|
|
|
|
[PATCH] Help scripts that use git-rev-parse to grok args with SP/TAB/LF
The git-rev-parse command uses LF to separate each argument it
parses, so its users at least need to set IFS to LF to be able
to handle filenames with embedded SPs and TABs. Some commands,
however, can take and do expect arguments with embedded LF,
notably, "-S" (pickaxe) of diff family, so even this workaround
does not work for them.
When --sq flag to git-rev-parse is given, instead of showing one
argument per line, it outputs arguments quoted for consumption
with "eval" by the caller, to remedy this situation.
As an example, this patch converts git-whatchanged to use this
new feature.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-23 04:08:32 +02:00
|
|
|
rev_list_args=$(git-rev-parse --sq --default HEAD --revs-only "$@") &&
|
2005-12-22 07:25:00 +01:00
|
|
|
diff_tree_args=$(git-rev-parse --sq --no-revs --no-flags "$@") &&
|
[PATCH] Help scripts that use git-rev-parse to grok args with SP/TAB/LF
The git-rev-parse command uses LF to separate each argument it
parses, so its users at least need to set IFS to LF to be able
to handle filenames with embedded SPs and TABs. Some commands,
however, can take and do expect arguments with embedded LF,
notably, "-S" (pickaxe) of diff family, so even this workaround
does not work for them.
When --sq flag to git-rev-parse is given, instead of showing one
argument per line, it outputs arguments quoted for consumption
with "eval" by the caller, to remedy this situation.
As an example, this patch converts git-whatchanged to use this
new feature.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-23 04:08:32 +02:00
|
|
|
|
2006-02-06 01:42:49 +01:00
|
|
|
eval "git-rev-list $count $rev_list_args" |
|
2005-12-22 07:25:00 +01:00
|
|
|
eval "git-diff-tree --stdin --pretty -r $diff_tree_flags $diff_tree_args" |
|
[PATCH] Help scripts that use git-rev-parse to grok args with SP/TAB/LF
The git-rev-parse command uses LF to separate each argument it
parses, so its users at least need to set IFS to LF to be able
to handle filenames with embedded SPs and TABs. Some commands,
however, can take and do expect arguments with embedded LF,
notably, "-S" (pickaxe) of diff family, so even this workaround
does not work for them.
When --sq flag to git-rev-parse is given, instead of showing one
argument per line, it outputs arguments quoted for consumption
with "eval" by the caller, to remedy this situation.
As an example, this patch converts git-whatchanged to use this
new feature.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-23 04:08:32 +02:00
|
|
|
LESS="$LESS -S" ${PAGER:-less}
|