summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c0fd1f5)
raw | patch | inline | side by side (parent: c0fd1f5)
author | Linus Torvalds <torvalds@g5.osdl.org> | |
Fri, 15 Jul 2005 00:59:17 +0000 (17:59 -0700) | ||
committer | Linus Torvalds <torvalds@g5.osdl.org> | |
Fri, 15 Jul 2005 00:59:17 +0000 (17:59 -0700) |
This removes the separate "formats" for name and name-with-zero-
termination.
It also removes the difference between HUMAN and MACHINE formats, and
they both become DIFF_FORMAT_RAW, with the difference being just in the
line and inter-filename termination.
It also makes the code easier to understand.
termination.
It also removes the difference between HUMAN and MACHINE formats, and
they both become DIFF_FORMAT_RAW, with the difference being just in the
line and inter-filename termination.
It also makes the code easier to understand.
diff-cache.c | patch | blob | history | |
diff-files.c | patch | blob | history | |
diff-helper.c | patch | blob | history | |
diff-stages.c | patch | blob | history | |
diff-tree.c | patch | blob | history | |
diff.c | patch | blob | history | |
diff.h | patch | blob | history |
diff --git a/diff-cache.c b/diff-cache.c
index e6373b3484d1102274f85a8711a69b3af0d3f426..e3c4c8155caeb8023e022194d828d9e515a2326d 100644 (file)
--- a/diff-cache.c
+++ b/diff-cache.c
#include "diff.h"
static int cached_only = 0;
-static int diff_output_format = DIFF_FORMAT_HUMAN;
+static int diff_output_format = DIFF_FORMAT_RAW;
+static int diff_line_termination = '\n';
static int match_nonexisting = 0;
static int detect_rename = 0;
static int find_copies_harder = 0;
continue;
}
if (!strcmp(arg, "-z")) {
- diff_output_format = DIFF_FORMAT_MACHINE;
+ diff_line_termination = 0;
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;
pickaxe, pickaxe_opts,
diff_break_opt,
orderfile, diff_filter);
- diff_flush(diff_output_format);
+ diff_flush(diff_output_format, diff_line_termination);
return ret;
}
diff --git a/diff-files.c b/diff-files.c
index 4e7d9673ce95cb0de71bdca1d73ec017781039ec..39dd54f80a7e81f7e67faf13ba79a0a8c9e077e7 100644 (file)
--- a/diff-files.c
+++ b/diff-files.c
"[<common diff options>] [<path>...]"
COMMON_DIFF_OPTIONS_HELP;
-static int diff_output_format = DIFF_FORMAT_HUMAN;
+static int diff_output_format = DIFF_FORMAT_RAW;
+static int diff_line_termination = '\n';
static int detect_rename = 0;
static int find_copies_harder = 0;
static int diff_setup_opt = 0;
else if (!strcmp(argv[1], "-s"))
; /* no-op */
else if (!strcmp(argv[1], "-z"))
- diff_output_format = DIFF_FORMAT_MACHINE;
+ diff_line_termination = 0;
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))
pickaxe, pickaxe_opts,
diff_break_opt,
orderfile, diff_filter);
- diff_flush(diff_output_format);
+ diff_flush(diff_output_format, diff_line_termination);
return 0;
}
diff --git a/diff-helper.c b/diff-helper.c
index 63aff6969863f6fb3da94c9866067e1c779831a3..6649fb548f798c84342168b8ef9fe9211093fbfc 100644 (file)
--- a/diff-helper.c
+++ b/diff-helper.c
diffcore_std_no_resolve(av + 1,
pickaxe, pickaxe_opts,
orderfile, diff_filter);
- diff_flush(DIFF_FORMAT_PATCH);
+ diff_flush(DIFF_FORMAT_PATCH, '\n');
}
static const char *diff_helper_usage =
diff --git a/diff-stages.c b/diff-stages.c
index 8d86d741791d155ac7b4c20489be6ed9288dde95..cbaba552b380403d3830b80ed3e65faacb4addc8 100644 (file)
--- a/diff-stages.c
+++ b/diff-stages.c
#include "cache.h"
#include "diff.h"
-static int diff_output_format = DIFF_FORMAT_HUMAN;
+static int diff_output_format = DIFF_FORMAT_RAW;
+static int diff_line_termination = '\n';
static int detect_rename = 0;
static int find_copies_harder = 0;
static int diff_setup_opt = 0;
else if (!strcmp(arg, "--find-copies-harder"))
find_copies_harder = 1;
else if (!strcmp(arg, "-z"))
- diff_output_format = DIFF_FORMAT_MACHINE;
+ diff_line_termination = 0;
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))
diff_break_opt,
orderfile,
diff_filter);
- diff_flush(diff_output_format);
+ diff_flush(diff_output_format, diff_line_termination);
return 0;
}
diff --git a/diff-tree.c b/diff-tree.c
index 4e80526afa3f55f71d0309c47b5eb1f04d6be402..5b9467d58b064de81bfecfeebd4dfac50e515cca 100644 (file)
--- a/diff-tree.c
+++ b/diff-tree.c
static int recursive = 0;
static int show_tree_entry_in_recursive = 0;
static int read_stdin = 0;
-static int diff_output_format = DIFF_FORMAT_HUMAN;
+static int diff_output_format = DIFF_FORMAT_RAW;
+static int diff_line_termination = '\n';
static int detect_rename = 0;
static int find_copies_harder = 0;
static int diff_setup_opt = 0;
orderfile,
diff_filter);
if (diff_queue_is_empty()) {
- diff_flush(DIFF_FORMAT_NO_OUTPUT);
+ diff_flush(DIFF_FORMAT_NO_OUTPUT, diff_line_termination);
return 0;
}
if (header) {
- printf("%s%c", header, diff_output_format == DIFF_FORMAT_MACHINE ? 0 : '\n');
+ printf("%s%c", header, diff_line_termination);
header = NULL;
}
- diff_flush(diff_output_format);
+ diff_flush(diff_output_format, diff_line_termination);
return 1;
}
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;
+ diff_line_termination = 0;
continue;
}
if (!strcmp(arg, "-m")) {
index d0962bac9629e886f6b4f7c30f0547542e94a237..3cb41c533313fdd70b3f13858c68032aeb08062a 100644 (file)
--- a/diff.c
+++ b/diff.c
diff_debug_queue("resolve-rename-copy done", q);
}
-void diff_flush(int diff_output_style)
+void diff_flush(int diff_output_style, int line_termination)
{
struct diff_queue_struct *q = &diff_queued_diff;
int i;
- int line_termination = '\n';
int inter_name_termination = '\t';
- if (diff_output_style == DIFF_FORMAT_MACHINE ||
- diff_output_style == DIFF_FORMAT_NAME_Z)
- line_termination = inter_name_termination = 0;
+ if (!line_termination)
+ inter_name_termination = 0;
for (i = 0; i < q->nr; i++) {
struct diff_filepair *p = q->queue[i];
case DIFF_FORMAT_PATCH:
diff_flush_patch(p);
break;
- case DIFF_FORMAT_HUMAN:
- case DIFF_FORMAT_MACHINE:
+ case DIFF_FORMAT_RAW:
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;
}
index 9f9ca8be5b628c5701ce414f105aaffae2c76a59..e0a3207a62eab9c72d74e3b15cfae660fbcdaa66 100644 (file)
--- a/diff.h
+++ b/diff.h
extern int diff_queue_is_empty(void);
-#define DIFF_FORMAT_HUMAN 0
-#define DIFF_FORMAT_MACHINE 1
+#define DIFF_FORMAT_RAW 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);
+extern void diff_flush(int output_style, int line_terminator);
#endif /* DIFF_H */