mirror of
https://github.com/git/git.git
synced 2024-12-12 11:24:02 +08:00
5bb2c65aba
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>
8 lines
264 B
Bash
Executable File
8 lines
264 B
Bash
Executable File
#!/bin/sh
|
|
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}
|