summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 944e3a8)
raw | patch | inline | side by side (parent: 944e3a8)
author | Junio C Hamano <junkio@cox.net> | |
Tue, 11 Apr 2006 00:36:53 +0000 (17:36 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 11 Apr 2006 02:44:18 +0000 (19:44 -0700) |
This new flag outputs the diff-raw output and diff-patch output
at the same time. Requested by Cogito.
Signed-off-by: Junio C Hamano <junkio@cox.net>
at the same time. Requested by Cogito.
Signed-off-by: Junio C Hamano <junkio@cox.net>
combine-diff.c | patch | blob | history | |
diff.c | patch | blob | history | |
diff.h | patch | blob | history |
diff --git a/combine-diff.c b/combine-diff.c
index eb0d757f47b74161c4bfc1212f4510a6790ff92a..011bb8db2dd4b5cbc22591c6e613247c14de4d2b 100644 (file)
--- a/combine-diff.c
+++ b/combine-diff.c
diffopts = *opt;
diffopts.output_format = DIFF_FORMAT_NO_OUTPUT;
+ diffopts.with_raw = 0;
diffopts.recursive = 1;
/* count parents */
num_paths++;
}
if (num_paths) {
+ if (opt->with_raw) {
+ int saved_format = opt->output_format;
+ opt->output_format = DIFF_FORMAT_RAW;
+ for (p = paths; p; p = p->next) {
+ if (show_combined_diff(p, num_parent, dense,
+ header, opt))
+ header = NULL;
+ }
+ opt->output_format = saved_format;
+ }
for (p = paths; p; p = p->next) {
if (show_combined_diff(p, num_parent, dense,
header, opt))
index 2fa285a8efc69fac1ba922b0b7ada9230de93c79..99d76d01e3c0b14e96742292addf4d121afb6ab7 100644 (file)
--- a/diff.c
+++ b/diff.c
const char *arg = av[0];
if (!strcmp(arg, "-p") || !strcmp(arg, "-u"))
options->output_format = DIFF_FORMAT_PATCH;
+ else if (!strcmp(arg, "--patch-with-raw")) {
+ options->output_format = DIFF_FORMAT_PATCH;
+ options->with_raw = 1;
+ }
else if (!strcmp(arg, "-z"))
options->line_termination = 0;
else if (!strncmp(arg, "-l", 2))
static void diff_flush_raw(struct diff_filepair *p,
int line_termination,
int inter_name_termination,
- struct diff_options *options)
+ struct diff_options *options,
+ int output_format)
{
int two_paths;
char status[10];
int abbrev = options->abbrev;
const char *path_one, *path_two;
- int output_format = options->output_format;
path_one = p->one->path;
path_two = p->two->path;
diff_debug_queue("resolve-rename-copy done", q);
}
-void diff_flush(struct diff_options *options)
+static void flush_one_pair(struct diff_filepair *p,
+ int diff_output_format,
+ struct diff_options *options)
{
- struct diff_queue_struct *q = &diff_queued_diff;
- int i;
int inter_name_termination = '\t';
- int diff_output_format = options->output_format;
int line_termination = options->line_termination;
-
if (!line_termination)
inter_name_termination = 0;
- for (i = 0; i < q->nr; i++) {
- struct diff_filepair *p = q->queue[i];
-
- switch (p->status) {
- case DIFF_STATUS_UNKNOWN:
+ switch (p->status) {
+ case DIFF_STATUS_UNKNOWN:
+ break;
+ case 0:
+ die("internal error in diff-resolve-rename-copy");
+ break;
+ default:
+ switch (diff_output_format) {
+ case DIFF_FORMAT_PATCH:
+ diff_flush_patch(p, options);
break;
- case 0:
- die("internal error in diff-resolve-rename-copy");
+ case DIFF_FORMAT_RAW:
+ case DIFF_FORMAT_NAME_STATUS:
+ diff_flush_raw(p, line_termination,
+ inter_name_termination,
+ options, diff_output_format);
+ break;
+ case DIFF_FORMAT_NAME:
+ diff_flush_name(p,
+ inter_name_termination,
+ line_termination);
+ break;
+ case DIFF_FORMAT_NO_OUTPUT:
break;
- default:
- switch (diff_output_format) {
- case DIFF_FORMAT_PATCH:
- diff_flush_patch(p, options);
- break;
- case DIFF_FORMAT_RAW:
- case DIFF_FORMAT_NAME_STATUS:
- diff_flush_raw(p, line_termination,
- inter_name_termination,
- options);
- break;
- case DIFF_FORMAT_NAME:
- diff_flush_name(p,
- inter_name_termination,
- line_termination);
- break;
- case DIFF_FORMAT_NO_OUTPUT:
- break;
- }
}
+ }
+}
+
+void diff_flush(struct diff_options *options)
+{
+ struct diff_queue_struct *q = &diff_queued_diff;
+ int i;
+ int diff_output_format = options->output_format;
+
+ if (options->with_raw) {
+ for (i = 0; i < q->nr; i++) {
+ struct diff_filepair *p = q->queue[i];
+ flush_one_pair(p, DIFF_FORMAT_RAW, options);
+ }
+ }
+ for (i = 0; i < q->nr; i++) {
+ struct diff_filepair *p = q->queue[i];
+ flush_one_pair(p, diff_output_format, options);
diff_free_filepair(p);
}
free(q->queue);