Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Teach "git diff" to handle filenames starting with '-'
author
Linus Torvalds
<torvalds@osdl.org>
Tue, 18 Oct 2005 07:16:45 +0000
(
00:16
-0700)
committer
Junio C Hamano
<junkio@cox.net>
Tue, 18 Oct 2005 07:16:45 +0000
(
00:16
-0700)
It adds "--" to the git-diff.sh scripts, to keep any filenames that start
with a "-" from being confused with an option.
But in order to do that, it needs to teach git-diff-files to honor "--".
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
diff-files.c
patch
|
blob
|
history
git-diff.sh
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
7a3dd47
)
diff --git
a/diff-files.c
b/diff-files.c
index 8a8f9b6dc77683bd7926f8599a2aa6eb03023b57..17899390b80f4bfc03718e92029b5c4de65055b6 100644
(file)
--- a/
diff-files.c
+++ b/
diff-files.c
@@
-41,6
+41,11
@@
int main(int argc, const char **argv)
git_config(git_default_config);
diff_setup(&diff_options);
while (1 < argc && argv[1][0] == '-') {
git_config(git_default_config);
diff_setup(&diff_options);
while (1 < argc && argv[1][0] == '-') {
+ if (!strcmp(argv[1], "--")) {
+ argv++;
+ argc--;
+ break;
+ }
if (!strcmp(argv[1], "-q"))
silent = 1;
else if (!strcmp(argv[1], "-r"))
if (!strcmp(argv[1], "-q"))
silent = 1;
else if (!strcmp(argv[1], "-r"))
diff --git
a/git-diff.sh
b/git-diff.sh
index 84a152af206166e88701b27acdc7d2b033e90bab..b3ec84be698311b30e8c7c793873e6caa41daf71 100755
(executable)
--- a/
git-diff.sh
+++ b/
git-diff.sh
@@
-28,16
+28,16
@@
case "$rev" in
?*' '^?*)
begin=$(expr "$rev" : '.*^.\([0-9a-f]*\).*') &&
end=$(expr "$rev" : '.\([0-9a-f]*\). .*') || exit
?*' '^?*)
begin=$(expr "$rev" : '.*^.\([0-9a-f]*\).*') &&
end=$(expr "$rev" : '.\([0-9a-f]*\). .*') || exit
- cmd="git-diff-tree $flags $begin $end $files"
+ cmd="git-diff-tree $flags $begin $end
--
$files"
;;
?*' '?*)
;;
?*' '?*)
- cmd="git-diff-tree $flags $rev $files"
+ cmd="git-diff-tree $flags $rev
--
$files"
;;
?*' ')
;;
?*' ')
- cmd="git-diff-index $flags $rev $files"
+ cmd="git-diff-index $flags $rev
--
$files"
;;
'')
;;
'')
- cmd="git-diff-files $flags $files"
+ cmd="git-diff-files $flags
--
$files"
;;
*)
die "I don't understand $*"
;;
*)
die "I don't understand $*"