projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Move "void *util" from "struct object" into "struct commit"
[git.git]
/
diff.c
diff --git
a/diff.c
b/diff.c
index
af5db0e
..
9e9cfc8
100644
(file)
--- a/
diff.c
+++ b/
diff.c
@@
-237,7
+237,7
@@
static char *pprint_rename(const char *a, const char *b)
if (a_midlen < 0) a_midlen = 0;
if (b_midlen < 0) b_midlen = 0;
if (a_midlen < 0) a_midlen = 0;
if (b_midlen < 0) b_midlen = 0;
- name = xmalloc(
len_a + len_b - pfx_length -
sfx_length + 7);
+ name = xmalloc(
pfx_length + a_midlen + b_midlen +
sfx_length + 7);
sprintf(name, "%.*s{%.*s => %.*s}%s",
pfx_length, a,
a_midlen, a + pfx_length,
sprintf(name, "%.*s{%.*s => %.*s}%s",
pfx_length, a,
a_midlen, a + pfx_length,
@@
-299,6
+299,7
@@
static void diffstat_consume(void *priv, char *line, unsigned long len)
static const char pluses[] = "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
static const char minuses[]= "----------------------------------------------------------------------";
static const char pluses[] = "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
static const char minuses[]= "----------------------------------------------------------------------";
+const char mime_boundary_leader[] = "------------";
static void show_stats(struct diffstat_t* data)
{
static void show_stats(struct diffstat_t* data)
{
@@
-431,7
+432,7
@@
static void checkdiff_consume(void *priv, char *line, unsigned long len)
else if (line[0] == '@') {
char *plus = strchr(line, '+');
if (plus)
else if (line[0] == '@') {
char *plus = strchr(line, '+');
if (plus)
- data->lineno = strtol(plus,
line + len
, 10);
+ data->lineno = strtol(plus,
NULL
, 10);
else
die("invalid diff");
}
else
die("invalid diff");
}
@@
-1303,6
+1304,14
@@
int diff_setup_done(struct diff_options *options)
(options->output_format == DIFF_FORMAT_CHECKDIFF))
options->recursive = 1;
(options->output_format == DIFF_FORMAT_CHECKDIFF))
options->recursive = 1;
+ /*
+ * These combinations do not make sense.
+ */
+ if (options->output_format == DIFF_FORMAT_RAW)
+ options->with_raw = 0;
+ if (options->output_format == DIFF_FORMAT_DIFFSTAT)
+ options->with_stat = 0;
+
if (options->detect_rename && options->rename_limit < 0)
options->rename_limit = diff_rename_limit_default;
if (options->setup & DIFF_SETUP_USE_CACHE) {
if (options->detect_rename && options->rename_limit < 0)
options->rename_limit = diff_rename_limit_default;
if (options->setup & DIFF_SETUP_USE_CACHE) {
@@
-1980,7
+1989,13
@@
void diff_flush(struct diff_options *options)
show_stats(diffstat);
free(diffstat);
diffstat = NULL;
show_stats(diffstat);
free(diffstat);
diffstat = NULL;
- putchar(options->line_termination);
+ if (options->summary)
+ for (i = 0; i < q->nr; i++)
+ diff_summary(q->queue[i]);
+ if (options->stat_sep)
+ fputs(options->stat_sep, stdout);
+ else
+ putchar(options->line_termination);
}
for (i = 0; i < q->nr; i++) {
struct diff_filepair *p = q->queue[i];
}
for (i = 0; i < q->nr; i++) {
struct diff_filepair *p = q->queue[i];
@@
-1993,7
+2008,7
@@
void diff_flush(struct diff_options *options)
}
for (i = 0; i < q->nr; i++) {
}
for (i = 0; i < q->nr; i++) {
- if (options->summary)
+ if (
diffstat &&
options->summary)
diff_summary(q->queue[i]);
diff_free_filepair(q->queue[i]);
}
diff_summary(q->queue[i]);
diff_free_filepair(q->queue[i]);
}