Merge branch 'js/t3404-grammo-fix' into maint
[gitweb.git] / reflog-walk.c
index 0ebd1da5ceb835066cf4eccd81eda4fba2cc0ac2..a246af27678a76d37c87bb56959ac050dff1f97f 100644 (file)
@@ -241,6 +241,12 @@ void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)
                logobj = parse_object(reflog->osha1);
        } while (commit_reflog->recno && (logobj && logobj->type != OBJ_COMMIT));
 
+       if (!logobj && commit_reflog->recno >= 0 && is_null_sha1(reflog->osha1)) {
+               /* a root commit, but there are still more entries to show */
+               reflog = &commit_reflog->reflogs->items[commit_reflog->recno];
+               logobj = parse_object(reflog->nsha1);
+       }
+
        if (!logobj || logobj->type != OBJ_COMMIT) {
                commit_info->commit = NULL;
                commit->parents = NULL;