Commit Diff


commit - ce95c694d0d3a388fa071650568993462d519527
commit + 7310c1c396a8a6126c9feed52a5243917fb4af99
blob - bab4b0a77b7a5f049bbe467cb5ecedd8b2a6b690
blob + 2e7bb672d0316dd4f4ef2ad74ecf15b916fc2e03
--- lib/commit_graph.c
+++ lib/commit_graph.c
@@ -180,10 +180,6 @@ detect_changed_path(int *changed, struct got_commit_ob
 	}
 
 	*changed = 0;
-
-	err = got_object_open_as_tree(&tree, repo, commit->tree_id);
-	if (err)
-		return err;
 
 	pid = SIMPLEQ_FIRST(&commit->parent_ids);
 	if (pid == NULL) {
@@ -196,6 +192,10 @@ detect_changed_path(int *changed, struct got_commit_ob
 			*changed = 1; /* The path was created in this commit. */
 		free(obj_id);
 	} else {
+		err = got_object_open_as_tree(&tree, repo, commit->tree_id);
+		if (err)
+			return err;
+
 		err = got_object_open_as_commit(&pcommit, repo, pid->id);
 		if (err)
 			goto done;