Commit Diff


commit - fc9b745fd3b1a01f7e89f269600db36ad5222b3e
commit + c8255edc87c31f45f65dcab98db4acfb9a7218dc
blob - 60e80af88cd8b83c0792aa2a88a615267cd87994
blob + 7838410468b039613a6a79dd0f886d3a3f4d77c9
--- lib/commit_graph.c
+++ lib/commit_graph.c
@@ -254,6 +254,7 @@ advance_branch(struct got_commit_graph *graph, struct 
 {
 	const struct got_error *err;
 	struct got_object_qid *qid;
+	struct got_object_id *merged_id = NULL;
 
 	err = close_branch(graph, commit_id);
 	if (err)
@@ -289,13 +290,16 @@ advance_branch(struct got_commit_graph *graph, struct 
 	 * which do not contribute any content to this path.
 	 */
 	if (commit->nparents > 1 && !got_path_is_root_dir(graph->path)) {
-		struct got_object_id *merged_id, *prev_id = NULL;
+		err = got_object_id_by_path(&merged_id, repo, commit, graph->path);
+		if (err && err->code != GOT_ERR_NO_TREE_ENTRY)
+			return err;
+		/* The requested path does not exist in this merge commit. */
+	}
+	if (commit->nparents > 1 && !got_path_is_root_dir(graph->path) &&
+	    merged_id != NULL) {
+		struct got_object_id *prev_id = NULL;
 		int branches_differ = 0;
 
-		err = got_object_id_by_path(&merged_id, repo, commit,
-		    graph->path);
-		if (err)
-			return err;
 
 		STAILQ_FOREACH(qid, &commit->parent_ids, entry) {
 			struct got_object_id *id = NULL;