summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8082d8d)
raw | patch | inline | side by side (parent: 8082d8d)
author | Junio C Hamano <junkio@cox.net> | |
Wed, 21 Sep 2005 07:20:06 +0000 (00:20 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 25 Sep 2005 06:50:44 +0000 (23:50 -0700) |
The new output format shows only the status letter and paths.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Documentation/diff-options.txt | patch | blob | history | |
diff.c | patch | blob | history | |
diff.h | patch | blob | history |
index 616d4a41220953236749fe6c0abcab2be57d7456..613a60d601df527bbd7a74717edfdc698ec35dd7 100644 (file)
--name-only::
Show only names of changed files.
---name-only-z::
- Same as --name-only, but terminate lines with NUL.
+--name-status::
+ Show only names and status of changed files.
-B::
Break complete rewrite changes into pairs of delete and create.
index cafc755406761f69e14584b4b459c15d92f1cf7b..9bded28729d6608f0449c483707f35279c24b1d5 100644 (file)
--- a/diff.c
+++ b/diff.c
options->rename_limit = strtoul(arg+2, NULL, 10);
else if (!strcmp(arg, "--name-only"))
options->output_format = DIFF_FORMAT_NAME;
+ else if (!strcmp(arg, "--name-status"))
+ options->output_format = DIFF_FORMAT_NAME_STATUS;
else if (!strcmp(arg, "-R"))
options->reverse_diff = 1;
else if (!strncmp(arg, "-S", 2))
static void diff_flush_raw(struct diff_filepair *p,
int line_termination,
- int inter_name_termination)
+ int inter_name_termination,
+ int output_format)
{
int two_paths;
char status[10];
two_paths = 0;
break;
}
- printf(":%06o %06o %s ",
- p->one->mode, p->two->mode, sha1_to_hex(p->one->sha1));
- printf("%s %s%c%s",
- sha1_to_hex(p->two->sha1),
- status,
- inter_name_termination,
- p->one->path);
+ if (output_format != DIFF_FORMAT_NAME_STATUS) {
+ printf(":%06o %06o %s ",
+ p->one->mode, p->two->mode, sha1_to_hex(p->one->sha1));
+ printf("%s ", sha1_to_hex(p->two->sha1));
+ }
+ printf("%s%c%s",status, inter_name_termination, p->one->path);
if (two_paths)
printf("%c%s", inter_name_termination, p->two->path);
putchar(line_termination);
diff_flush_patch(p);
break;
case DIFF_FORMAT_RAW:
+ case DIFF_FORMAT_NAME_STATUS:
diff_flush_raw(p, line_termination,
- inter_name_termination);
+ inter_name_termination,
+ diff_output_format);
break;
case DIFF_FORMAT_NAME:
diff_flush_name(p, line_termination);
index 2e32870901fecb5da726c1038f18fb532464bf5e..7f4079c87104afd8bda23046942121b7d3ff62ee 100644 (file)
--- a/diff.h
+++ b/diff.h
" -p output patch format.\n" \
" -u synonym for -p.\n" \
" --name-only show only names of changed files.\n" \
+" --name-status show names and status of changed files.\n" \
" -R swap input file pairs.\n" \
" -B detect complete rewrites.\n" \
" -M detect renames.\n" \
#define DIFF_FORMAT_PATCH 2
#define DIFF_FORMAT_NO_OUTPUT 3
#define DIFF_FORMAT_NAME 4
+#define DIFF_FORMAT_NAME_STATUS 5
extern void diff_flush(struct diff_options*);