about summary refs log tree commit diff
path: root/ui-tree.c
diff options
context:
space:
mode:
authorJeff Smith <whydoubt@gmail.com>2017-08-09 19:02:56 -0500
committerJason A. Donenfeld <Jason@zx2c4.com>2017-08-10 15:58:24 +0200
commit86a6d358f7a6c2432fde86b9e3c5011a656f20e4 (patch)
tree0f43ea3514fba419d5a5d99cf731f96daa2765c0 /ui-tree.c
parentgit: update to v2.13.4 (diff)
downloadcgit-pink-86a6d358f7a6c2432fde86b9e3c5011a656f20e4.tar.gz
cgit-pink-86a6d358f7a6c2432fde86b9e3c5011a656f20e4.zip
git: update to v2.14
Numerous changes were made to git functions to use an object_id
structure rather than sending sha1 hashes as raw unsigned character
arrays.  The functions that affect cgit are: parse_object,
lookup_commit_reference, lookup_tag, lookup_tree, parse_tree_indirect,
diff_root_tree_sha1, diff_tree_sha1, and format_display_notes.

Commit b2141fc (config: don't include config.h by default) made it
necessary to that config.h be explicitly included when needed.

Commit 07a3d41 (grep: remove regflags from the public grep_opt API)
removed one way of specifying the ignore-case grep option.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Diffstat (limited to 'ui-tree.c')
-rw-r--r--ui-tree.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/ui-tree.c b/ui-tree.c
index b310242..ca24a03 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -157,7 +157,7 @@ static void print_object(const unsigned char *sha1, char *path, const char *base
 
 struct single_tree_ctx {
 	struct strbuf *path;
-	unsigned char sha1[GIT_SHA1_RAWSZ];
+	struct object_id oid;
 	char *name;
 	size_t count;
 };
@@ -177,7 +177,7 @@ static int single_tree_cb(const unsigned char *sha1, struct strbuf *base,
 	}
 
 	ctx->name = xstrdup(pathname);
-	hashcpy(ctx->sha1, sha1);
+	hashcpy(ctx->oid.hash, sha1);
 	strbuf_addf(ctx->path, "/%s", pathname);
 	return 0;
 }
@@ -195,13 +195,13 @@ static void write_tree_link(const unsigned char *sha1, char *name,
 		.nr = 0
 	};
 
-	hashcpy(tree_ctx.sha1, sha1);
+	hashcpy(tree_ctx.oid.hash, sha1);
 
 	while (tree_ctx.count == 1) {
 		cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, rev,
 			       fullpath->buf);
 
-		tree = lookup_tree(tree_ctx.sha1);
+		tree = lookup_tree(&tree_ctx.oid);
 		if (!tree)
 			return;
 
@@ -300,17 +300,17 @@ static void ls_tail(void)
 	cgit_print_layout_end();
 }
 
-static void ls_tree(const unsigned char *sha1, char *path, struct walk_tree_context *walk_tree_ctx)
+static void ls_tree(const struct object_id *oid, char *path, struct walk_tree_context *walk_tree_ctx)
 {
 	struct tree *tree;
 	struct pathspec paths = {
 		.nr = 0
 	};
 
-	tree = parse_tree_indirect(sha1);
+	tree = parse_tree_indirect(oid);
 	if (!tree) {
 		cgit_print_error_page(404, "Not found",
-			"Not a tree object: %s", sha1_to_hex(sha1));
+			"Not a tree object: %s", sha1_to_hex(oid->hash));
 		return;
 	}
 
@@ -380,7 +380,7 @@ void cgit_print_tree(const char *rev, char *path)
 			"Invalid revision name: %s", rev);
 		return;
 	}
-	commit = lookup_commit_reference(oid.hash);
+	commit = lookup_commit_reference(&oid);
 	if (!commit || parse_commit(commit)) {
 		cgit_print_error_page(404, "Not found",
 			"Invalid commit reference: %s", rev);
@@ -390,7 +390,7 @@ void cgit_print_tree(const char *rev, char *path)
 	walk_tree_ctx.curr_rev = xstrdup(rev);
 
 	if (path == NULL) {
-		ls_tree(commit->tree->object.oid.hash, NULL, &walk_tree_ctx);
+		ls_tree(&commit->tree->object.oid, NULL, &walk_tree_ctx);
 		goto cleanup;
 	}