Diff options
Diffstat (limited to '')
-rw-r--r--source/ui-blob.c14
1 file changed, 4 insertions, 10 deletions
diff --git a/source/ui-blob.c b/source/ui-blob.c
index 5118ac2..4ed9b3b 100644
--- a/source/ui-blob.c
+++ b/source/ui-blob.c
@@ -57,7 +57,7 @@ static int walk_tree(const struct object_id *oid, struct strbuf *base,
* oid comes in naming a commit and goes out naming the blob found at path,
* which every caller relies on.
*/
-static int find_path_oid(struct object_id *oid, char *path, int file_only)
+static int find_path_oid(struct object_id *oid, const char *path, int file_only)
{
struct commit *commit = lookup_commit_reference(the_repository, oid);
struct tree *tree;
@@ -86,19 +86,13 @@ int cgit_ref_path_exists(const char *path, const char *ref)
{
struct object_id oid;
size_t size;
- char *path_copy = xstrdup(path);
- int found = 0;
if (repo_get_oid(the_repository, ref, &oid))
- goto done;
+ return 0;
peel_to_commit(&oid);
if (odb_read_object_info(the_repository->objects, &oid, &size) != OBJ_COMMIT)
- goto done;
- found = find_path_oid(&oid, path_copy, 1);
-
-done:
- free(path_copy);
- return found;
+ return 0;
+ return find_path_oid(&oid, path, 1);
}
int cgit_print_file(char *path, const char *head, int html_escape)