Commit Diff


commit - 6eb07a178cf613c9648650b6e16604706c4aede4
commit + fd1d2703b833d6456b44614e09f14e3f8d7a826c
blob - ac9d7fa1d5cd2d6cb018d0686551d72ddf67dfaa
blob + da78aa18feeb760a6cb864f8a604b5ac2ccb3cad
--- lib/commit_graph.c
+++ lib/commit_graph.c
@@ -187,23 +187,24 @@ detect_changed_path(int *changed, struct got_commit_ob
 	if (pid == NULL) {
 		struct got_object_id *obj_id;
 		err = got_object_id_by_path(&obj_id, repo, commit_id, path);
-		if (err)
-			err = NULL;
-		else
-			*changed = 1;
+		if (err) {
+			if (err->code == GOT_ERR_NO_OBJ)
+				err = NULL;
+		} else
+			*changed = 1; /* The path was created in this commit. */
 		free(obj_id);
-		goto done;
-	}
-
-	err = got_object_open_as_commit(&pcommit, repo, pid->id);
-	if (err)
-		goto done;
+	} else {
+		err = got_object_open_as_commit(&pcommit, repo, pid->id);
+		if (err)
+			goto done;
 
-	err = got_object_open_as_tree(&ptree, repo, pcommit->tree_id);
-	if (err)
-		goto done;
+		err = got_object_open_as_tree(&ptree, repo, pcommit->tree_id);
+		if (err)
+			goto done;
 
-	err = got_object_tree_path_changed(changed, tree, ptree, path, repo);
+		err = got_object_tree_path_changed(changed, tree, ptree, path,
+		    repo);
+	}
 done:
 	if (tree)
 		got_object_tree_close(tree);