Handle "-" at beginning of filenames, part 3

This fixes the default built-in exec() of "diff" to add a "--" before the
filenames, so that if a filename starts with a "-", the diff program won't
think it's an option.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Linus Torvalds 2005-10-18 00:16:45 -07:00 committed by Junio C Hamano
parent ea51d416c0
commit 694a764fc2

2
diff.c
View File

@ -174,7 +174,7 @@ static void builtin_diff(const char *name_a,
{
int i, next_at, cmd_size;
const char *const diff_cmd = "diff -L%s -L%s";
const char *const diff_arg = "%s %s||:"; /* "||:" is to return 0 */
const char *const diff_arg = "-- %s %s||:"; /* "||:" is to return 0 */
const char *input_name_sq[2];
const char *label_path[2];
char *cmd;