Re: [PATCH 2/2] date: make "local" orthogonal to date format
- From
Jeff King <peff@peff.net>
- Date
- Aug 31, 2015, 21:33 UTC
- Message-ID
- <20150831213336.GA11720@sigill.intra.peff.net>
- In-Reply-To
- <20150831212754.GD30659@serenity.lan>
On Mon, Aug 31, 2015 at 10:27:54PM +0100, John Keeping wrote:
Show 11 quoted lines
> This fails t6300 with: > > fatal: unknown date-mode modifier: my date is %Y-%m-%d > not ok 83 - Check format of strftime date fields > # > # echo "my date is 2006-07-03" >expected && > # git for-each-ref \ > # --format="%(authordate:format:my date is %Y-%m-%d)" \ > # refs/heads >actual && > # test_cmp expected actual > #
Whoops. I obviously did not actually run the test suite. I think when writing the commit message, my brain said "we are not changing anything, so no need to run the tests", forgetting that I did not run them the first time when posting an untested "eh, how about this" patch.
Show 15 quoted lines
> The following squash-in fixes it:
>
> diff --git a/date.c b/date.c
> index aa57cad..3aa8002 100644
> --- a/date.c
> +++ b/date.c
> @@ -817,9 +817,7 @@ void parse_date_format(const char *format, struct date_mode *mode)
> if (!skip_prefix(p, ":", &p))
> die("date format missing colon separator: %s", format);
> mode->strftime_fmt = xstrdup(p);
> - }
> -
> - if (*p)
> + } else if (*p)
> die("unknown date-mode modifier: %s", p);Yeah, that works. We could also advance "p" in the DATE_STRFTIME conditional, but I think your solution is less ugly.
Thanks for debugging my mess.
-Peff