diff_output_format = DIFF_FORMAT_MACHINE;
continue;
}
+ if (!strcmp(arg, "--name-only")) {
+ diff_output_format = DIFF_FORMAT_NAME;
+ continue;
+ }
+ if (!strcmp(arg, "--name-only-z")) {
+ diff_output_format = DIFF_FORMAT_NAME_Z;
+ continue;
+ }
if (!strcmp(arg, "-R")) {
diff_setup_opt |= DIFF_SETUP_REVERSE;
continue;
; /* no-op */
else if (!strcmp(argv[1], "-z"))
diff_output_format = DIFF_FORMAT_MACHINE;
+ else if (!strcmp(argv[1], "--name-only"))
+ diff_output_format = DIFF_FORMAT_NAME;
+ else if (!strcmp(argv[1], "--name-only-z"))
+ diff_output_format = DIFF_FORMAT_NAME_Z;
else if (!strcmp(argv[1], "-R"))
diff_setup_opt |= DIFF_SETUP_REVERSE;
else if (!strncmp(argv[1], "-S", 2))
find_copies_harder = 1;
else if (!strcmp(arg, "-z"))
diff_output_format = DIFF_FORMAT_MACHINE;
+ else if (!strcmp(arg, "--name-only"))
+ diff_output_format = DIFF_FORMAT_NAME;
+ else if (!strcmp(arg, "--name-only-z"))
+ diff_output_format = DIFF_FORMAT_NAME_Z;
else if (!strcmp(arg, "-R"))
diff_setup_opt |= DIFF_SETUP_REVERSE;
else if (!strncmp(arg, "-S", 2))
find_copies_harder = 1;
continue;
}
+ if (!strcmp(arg, "--name-only")) {
+ diff_output_format = DIFF_FORMAT_NAME;
+ continue;
+ }
+ if (!strcmp(arg, "--name-only-z")) {
+ diff_output_format = DIFF_FORMAT_NAME_Z;
+ continue;
+ }
if (!strcmp(arg, "-z")) {
diff_output_format = DIFF_FORMAT_MACHINE;
continue;
putchar(line_termination);
}
+static void diff_flush_name(struct diff_filepair *p,
+ int line_termination)
+{
+ printf("%s%c", p->two->path, line_termination);
+}
+
int diff_unmodified_pair(struct diff_filepair *p)
{
/* This function is written stricter than necessary to support
int line_termination = '\n';
int inter_name_termination = '\t';
- if (diff_output_style == DIFF_FORMAT_MACHINE)
+ if (diff_output_style == DIFF_FORMAT_MACHINE ||
+ diff_output_style == DIFF_FORMAT_NAME_Z)
line_termination = inter_name_termination = 0;
for (i = 0; i < q->nr; i++) {
diff_flush_raw(p, line_termination,
inter_name_termination);
break;
+ case DIFF_FORMAT_NAME:
+ case DIFF_FORMAT_NAME_Z:
+ diff_flush_name(p, line_termination);
+ break;
}
}
for (i = 0; i < q->nr; i++)
#define DIFF_FORMAT_MACHINE 1
#define DIFF_FORMAT_PATCH 2
#define DIFF_FORMAT_NO_OUTPUT 3
+#define DIFF_FORMAT_NAME 4
+#define DIFF_FORMAT_NAME_Z 5
extern void diff_flush(int output_style);