commit - cb3528126b0c316de49661eb97920112c6e997c4
commit + fcc85cad4890e3f30b1e1d4e07c46d0fae1d9c61
blob - ab9e4f8cd7e4d6942534a6dd139aee851a992d30
blob + 0575cacc5f4bccf001c9eba8bcb56f1b6c71ad16
--- got/got.c
+++ got/got.c
const struct got_error *err;
struct got_commit_graph *graph;
int ncommits, found_obj = 0;
+ int is_root_path = (strcmp(path, "/") != 0);
err = got_commit_graph_open(&graph, root_id, first_parent_traversal,
repo);
return err;
err = got_commit_graph_iter_start(graph, root_id);
if (err)
- return err;
+ goto done;
do {
struct got_commit_object *commit;
struct got_object_id *id;
err = got_object_open_as_commit(&commit, repo, id);
if (err)
- return err;
- if (path) {
+ break;
+ if (!is_root_path) {
struct got_object *obj;
struct got_object_qid *pid;
int changed = 0;
err = got_object_open_by_path(&obj, repo, id, path);
if (err) {
+ got_object_commit_close(commit);
if (err->code == GOT_ERR_NO_OBJ && found_obj) {
/*
- * Object was added in previous commit.
- * History stops here.
+ * History of the path stops here
+ * on the current commit's branch.
+ * Keep logging on other branches.
*/
err = NULL;
+ continue;
}
break;
}
if (err) {
if (err->code != GOT_ERR_NO_OBJ) {
got_object_close(obj);
+ got_object_commit_close(commit);
break;
}
err = NULL;
got_object_close(pobj);
}
}
+ got_object_close(obj);
if (!changed) {
got_object_commit_close(commit);
continue;
if (err || (limit && --limit == 0))
break;
} while (ncommits > 0);
-
+done:
got_commit_graph_close(graph);
return err;
}