ident: die on bogus date format
commit4579bb418c2995a8459de7dba42b63a26006f9a6
authorJeff King <peff@peff.net>
Mon, 13 Dec 2010 17:02:25 +0000 (13 12:02 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 20 Dec 2010 18:28:19 +0000 (20 10:28 -0800)
tree578b3d9b4643c2a789ca355f5974822d7eaefb8c
parent05bb5a2584ca0e1c87a2135a83c5573b9337d06f
ident: die on bogus date format

If the user gives "git commit --date=foobar", we silently
ignore the --date flag. We should note the error.

This patch puts the fix at the lowest level of fmt_ident,
which means it also handles GIT_AUTHOR_DATE=foobar, as well.

There are two down-sides to this approach:

  1. Technically this breaks somebody doing something like
     "git commit --date=now", which happened to work because
     bogus data is the same as "now". Though we do
     explicitly handle the empty string, so anybody passing
     an empty variable through the environment will still
     work.

     If the error is too much, perhaps it can be downgraded
     to a warning?

  2. The error checking happens _after_ the commit message
     is written, which can be annoying to the user. We can
     put explicit checks closer to the beginning of
     git-commit, but that feels a little hack-ish; suddenly
     git-commit has to care about how fmt_ident works. Maybe
     we could simply call fmt_ident earlier?

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
ident.c
t/t7501-commit.sh