Commit Diff


commit - 2698e19876c3e5680cbec8b2267b360d2cf080ac
commit + bae38d30ef50432e0083cb668dcb58e416fa70ea
blob - 3567f7635ec5cb569326cc57275b021ce3dd16e7
blob + a8261cdc230343efc102643019fd4922ebc775f5
--- lib/commit_graph.c
+++ lib/commit_graph.c
@@ -253,6 +253,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)
@@ -288,13 +289,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;