Commit 350efba7a8218ebaa7ee2bf8f07c78242d2a5a1c

Stefan Sperling 2018-05-20T14:18:12

fix diff display for last entry in tog log view

diff --git a/tog/tog.c b/tog/tog.c
index ba91b30..a1ae0b1 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -556,15 +556,21 @@ static const struct got_error *
 show_commit(struct commit_queue_entry *entry, struct got_repository *repo)
 {
 	const struct got_error *err;
+	struct commit_queue_entry *pentry;
 	struct got_object *obj1 = NULL, *obj2 = NULL;
 
 	err = got_object_open(&obj2, repo, entry->id);
 	if (err)
 		return err;
 
-	entry = TAILQ_NEXT(entry, entry);
-	if (entry) {
-		err = got_object_open(&obj1, repo, entry->id);
+	pentry = TAILQ_NEXT(entry, entry);
+	if (pentry == NULL) {
+		err = fetch_parent_commit(&pentry, entry, repo);
+		if (err)
+			return err;
+	}
+	if (pentry) {
+		err = got_object_open(&obj1, repo, pentry->id);
 		if (err)
 			goto done;
 	}