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>
Linus Torvalds committed
Oct 18, 2005 at 00:16 UTC
694a764fc2af9463c2462ab1fc92b442fce1a54c
1 file changed
+1
-1
diff.c
+1
-1
@@ -174,7 +174,7 @@ static void builtin_diff(const char *name_a,
174
{
175
int i, next_at, cmd_size;
176
const char *const diff_cmd = "diff -L%s -L%s";
177
- const char *const diff_arg = "%s %s||:"; /* "||:" is to return 0 */
177
+ const char *const diff_arg = "-- %s %s||:"; /* "||:" is to return 0 */
178
const char *input_name_sq[2];
179
const char *label_path[2];
180
char *cmd;