Control: forwarded -1 https://gitlab.gnome.org/GNOME/gitg/issues/73 Control: tags -1 + patch
On Mon, 19 Aug 2019 at 18:53:12 -0400, Daniel Kahn Gillmor wrote: > try this (without any gitg instance already running): > > $ git clone https://github.com/libreswan/libreswan > $ cd libreswan > $ gitg For a more GNOME-adjacent reproducer, the git repository for libostree has the same issue. > The result is a bunch of lines like the following to stderr: > > (gitg:27936): GLib-CRITICAL **: 18:50:32.798: g_date_time_difference: > assertion 'begin != NULL' failed > (gitg:27944): GLib-CRITICAL **: 18:50:36.949: g_date_time_difference: > assertion 'end != NULL' failed gitg's GitgHistory.RefRow.compare_to, when sorting by last activity, appears to be wrongly assuming that a GgitSignature object's get_time() always returns non-NULL. The method return is annotated as (nullable) in libgit2-glib, which I would have expected would cause the Vala compiler to at least issue warnings here, but perhaps I'm overestimating valac's ability to understand GObject-Introspection annotations. (I don't know whether a GitgSignature represents a signed tag or some more abstract concept like a commit, but either way, I could believe that git repositories with a long history will have some tags or commits where the date/time cannot be parsed.) I don't really know Vala, but the attached seems to work. smcv
From: Simon McVittie <[email protected]> Date: Tue, 20 Aug 2019 10:49:45 +0100 Subject: GitgHistory.RefRow: Don't assume that every GgitSignature has a time The libostree and libreswan git repositories include counterexamples. Signed-off-by: Simon McVittie <[email protected]> Bug: https://gitlab.gnome.org/GNOME/gitg/issues/73 Bug-Debian: https://bugs.debian.org/935136 --- gitg/history/gitg-history-refs-list.vala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gitg/history/gitg-history-refs-list.vala b/gitg/history/gitg-history-refs-list.vala index e5188bc..6d07c00 100644 --- a/gitg/history/gitg-history-refs-list.vala +++ b/gitg/history/gitg-history-refs-list.vala @@ -286,8 +286,11 @@ private class RefRow : RefTyped, Gtk.ListBoxRow { var c1 = d_updated; var c2 = other.updated; + var dt1 = c1.get_time(); + var dt2 = c2.get_time(); - return c2.get_time().compare(c1.get_time()); + if (dt1 != null && dt2 != null) + return dt2.compare(dt1); } }

