From 5bb2c65aba9161ee77c42002009634e757005b4f Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 22 Jul 2005 19:08:32 -0700 Subject: [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 Signed-off-by: Linus Torvalds --- git-whatchanged | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'git-whatchanged') diff --git a/git-whatchanged b/git-whatchanged index 6fbd115601..85a49fcd8e 100755 --- a/git-whatchanged +++ b/git-whatchanged @@ -1,4 +1,7 @@ #!/bin/sh -git-rev-list $(git-rev-parse --default HEAD --revs-only "$@") | - git-diff-tree --stdin --pretty -r $(git-rev-parse --no-revs "$@") | - LESS="$LESS -S" ${PAGER:-less} +rev_list_args=$(git-rev-parse --sq --default HEAD --revs-only "$@") && +diff_tree_args=$(git-rev-parse --sq --no-revs "$@") && + +eval "git-rev-list $rev_list_args" | +eval "git-diff-tree --stdin --pretty -r $diff_tree_args" | +LESS="$LESS -S" ${PAGER:-less} -- cgit v1.2.3