Looks like a sensible change. split_ident_line() decided that the
given input was mangled and decided there is no valid date (the
input had <> where the timestamp string was required), so the
updated code leaves the time/tz unspecified.
It still is curious how a malformed line was created in the first
place. I wouldn't worry if a private tool used hash-object to
create such a commit, but if it is something that is commonly used
(e.g. "git commit"), others may suffer from the same and the tool
needs to be tightened a bit.
Looks like a sensible change. split_ident_line() decided that the
given input was mangled and decided there is no valid date (the
input had <> where the timestamp string was required), so the
updated code leaves the time/tz unspecified.
We'd need update pretty.c::format_person_part() and
builtin/blame.c::get_ac_line() as well, though.
How about making split_ident_line() a bit friendlier be letting it
provide the epoch as default time stamp instead of NULL? We shouldn't
do that if we'd like to be able to tell a missing/broken time stamp
apart from a commit that was actually made back in 1970 (e.g. an
imported one). Or if we'd like to not show a time stamp in git log
output at all in that case.
-- >8 --
Subject: ident: let split_ident_line() provide a default time stamp
If a commit has a broken time stamp, split_ident_line() sets
date_begin, date_end, tz_begin and tz_end to NULL. Not all callers
are prepared to handle that case and segfault.
Instead of fixing them and having to be careful while implementing
the next caller, provide a string consisting of the number zero as
default value, representing the UNIX epoch. That's the value that
git log showed before it was converted to use split_ident_line().
Reported-by: Ivan Lyapunov <redacted>
Signed-off-by: Rene Scharfe <redacted>
---
ident.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
From: Antoine Pelisse <hidden> Date: 2016-06-15 22:56:52
On Tue, Apr 16, 2013 at 9:45 PM, Junio C Hamano [off-list ref] wrote:
It still is curious how a malformed line was created in the first
place. I wouldn't worry if a private tool used hash-object to
create such a commit, but if it is something that is commonly used
(e.g. "git commit"), others may suffer from the same and the tool
needs to be tightened a bit.
I already happened to see one like that, and it was clearly imported
through remote-hg. I've not been able to reproduce though, and the
parser in git-fast-import seemed already robust enough to me to not
allow this kind of messed-up line. I will see if I can find some time
to reproduce/investigate this deeper.
Looks like a sensible change. split_ident_line() decided that the
given input was mangled and decided there is no valid date (the
input had <> where the timestamp string was required), so the
updated code leaves the time/tz unspecified.