Commit Diff


commit - 924153d61966399fb9d766961f5ecceb2c97cb48
commit + 466429a10acdc69e2e92b490782f474e3971d5b0
blob - 142e928085820636cbb29c1fa78ac6548736871b
blob + 4f9d19c2a2e6171c24ae7b11e06be219013299fe
--- tog/tog.c
+++ tog/tog.c
@@ -3789,8 +3789,19 @@ input_log_view(struct tog_view **new_view, struct tog_
 			err = got_repo_match_object_id(&start_id, NULL,
 			    s->head_ref_name ? s->head_ref_name : GOT_REF_HEAD,
 			    GOT_OBJ_TYPE_COMMIT, &tog_refs, s->repo);
-			if (err)
-				return err;
+			if (err) {
+				if (s->head_ref_name == NULL ||
+				    err->code != GOT_ERR_NOT_REF)
+					return err;
+				/* Try to cope with deleted references. */
+				free(s->head_ref_name);
+				s->head_ref_name = NULL;
+				err = got_repo_match_object_id(&start_id,
+				    NULL, GOT_REF_HEAD, GOT_OBJ_TYPE_COMMIT,
+				    &tog_refs, s->repo);
+				if (err)
+					return err;
+			}
 			free(s->start_id);
 			s->start_id = start_id;
 			s->thread_args.start_id = s->start_id;