From fa0cdab537b1ae635b5a64cddd29cddf2dfc4a1b Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 4 Apr 2006 22:57:15 -0700 Subject: parse_date(): fix parsing 03/10/2006 The comment associated with the date parsing code for three numbers separated with slashes or dashes implied we wanted to interpret using this order: yyyy-mm-dd yyyy-dd-mm mm-dd-yy dd-mm-yy However, the actual code had the last two wrong, and making it prefer dd-mm-yy format over mm-dd-yy. Signed-off-by: Junio C Hamano --- date.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/date.c b/date.c index 416ea579a3..18a07103d8 100644 --- a/date.c +++ b/date.c @@ -257,10 +257,10 @@ static int match_multi_number(unsigned long num, char c, const char *date, char break; } /* mm/dd/yy ? */ - if (is_date(num3, num2, num, tm)) + if (is_date(num3, num, num2, tm)) break; /* dd/mm/yy ? */ - if (is_date(num3, num, num2, tm)) + if (is_date(num3, num2, num, tm)) break; return 0; } -- cgit v1.2.3 From 7d6c447145c07bb7d96a9aa17e33838fbe76e405 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 5 Apr 2006 02:06:49 -0700 Subject: diff_flush(): leakfix. We were leaking filepairs when output-format was set to NO_OUTPUT. Signed-off-by: Junio C Hamano --- diff.c | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/diff.c b/diff.c index 890bdaa6b8..fa1613c2f1 100644 --- a/diff.c +++ b/diff.c @@ -1225,28 +1225,34 @@ void diff_flush(struct diff_options *options) for (i = 0; i < q->nr; i++) { struct diff_filepair *p = q->queue[i]; - if ((diff_output_format == DIFF_FORMAT_NO_OUTPUT) || - (p->status == DIFF_STATUS_UNKNOWN)) - continue; - if (p->status == 0) - die("internal error in diff-resolve-rename-copy"); - 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); + + switch (p->status) { + case DIFF_STATUS_UNKNOWN: break; - case DIFF_FORMAT_NAME: - diff_flush_name(p, - inter_name_termination, - line_termination); + 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 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; + } } - diff_free_filepair(q->queue[i]); + diff_free_filepair(p); } free(q->queue); q->queue = NULL; -- cgit v1.2.3