List for cgit developers and users
 help / color / mirror / Atom feed
From: john at keeping.me.uk (John Keeping)
Subject: [RFC PATCH 1/4] git: update to v2.14
Date: Sat, 22 Jul 2017 12:25:11 +0100	[thread overview]
Message-ID: <20170722112511.GE1600@john.keeping.me.uk> (raw)
In-Reply-To: <20170608021810.12964-2-whydoubt@gmail.com>

On Wed, Jun 07, 2017 at 09:18:07PM -0500, Jeff Smith wrote:
> Update to git version v2.14: commit 6b526ce (Merge branch bc/object-id)
> merged changes for several functions from using sha1 hashes to using
> struct object_id pointers.  The functions that affect cgit are:
> parse_object, lookup_commit_reference, lookup_tag, lookup_tree, and
> parse_tree_indirect.
> 
> Signed-off-by: Jeff Smith <whydoubt at gmail.com>

Of course, our tests fail with this patch because the submodule has been
updated without the Makefile... other than that, the changes all look
reasonable, so when 2.14 final is out and we can update the Makefile to
a tag:

Reviewed-by: John Keeping <john at keeping.me.uk>

> ---
>  git           |  2 +-
>  shared.c      |  2 +-
>  ui-blob.c     |  6 +++---
>  ui-clone.c    |  2 +-
>  ui-commit.c   |  4 ++--
>  ui-diff.c     |  4 ++--
>  ui-patch.c    |  4 ++--
>  ui-plain.c    |  2 +-
>  ui-snapshot.c |  2 +-
>  ui-tag.c      |  4 ++--
>  ui-tree.c     | 18 +++++++++---------
>  11 files changed, 25 insertions(+), 25 deletions(-)
> 
> diff --git a/git b/git
> index 2c04f63..8d1b103 160000
> --- a/git
> +++ b/git
> @@ -1 +1 @@
> -Subproject commit 2c04f6340579518c55a554fcac9fe21c01b3d3ea
> +Subproject commit 8d1b10321b20bd2a73a5b561cfc3cf2e8051b70b
> diff --git a/shared.c b/shared.c
> index 13a65a9..c93b193 100644
> --- a/shared.c
> +++ b/shared.c
> @@ -160,7 +160,7 @@ static struct refinfo *cgit_mk_refinfo(const char *refname, const struct object_
>  
>  	ref = xmalloc(sizeof (struct refinfo));
>  	ref->refname = xstrdup(refname);
> -	ref->object = parse_object(oid->hash);
> +	ref->object = parse_object(oid);
>  	switch (ref->object->type) {
>  	case OBJ_TAG:
>  		ref->tag = cgit_parse_tag((struct tag *)ref->object);
> diff --git a/ui-blob.c b/ui-blob.c
> index 793817f..761e886 100644
> --- a/ui-blob.c
> +++ b/ui-blob.c
> @@ -56,7 +56,7 @@ int cgit_ref_path_exists(const char *path, const char *ref, int file_only)
>  		goto done;
>  	if (sha1_object_info(oid.hash, &size) != OBJ_COMMIT)
>  		goto done;
> -	read_tree_recursive(lookup_commit_reference(oid.hash)->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
> +	read_tree_recursive(lookup_commit_reference(&oid)->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
>  
>  done:
>  	free(path_items.match);
> @@ -89,7 +89,7 @@ int cgit_print_file(char *path, const char *head, int file_only)
>  		return -1;
>  	type = sha1_object_info(oid.hash, &size);
>  	if (type == OBJ_COMMIT) {
> -		commit = lookup_commit_reference(oid.hash);
> +		commit = lookup_commit_reference(&oid);
>  		read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
>  		if (!walk_tree_ctx.found_path)
>  			return -1;
> @@ -145,7 +145,7 @@ void cgit_print_blob(const char *hex, char *path, const char *head, int file_onl
>  	type = sha1_object_info(oid.hash, &size);
>  
>  	if ((!hex) && type == OBJ_COMMIT && path) {
> -		commit = lookup_commit_reference(oid.hash);
> +		commit = lookup_commit_reference(&oid);
>  		read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
>  		type = sha1_object_info(oid.hash, &size);
>  	}
> diff --git a/ui-clone.c b/ui-clone.c
> index 5f6606a..0d11672 100644
> --- a/ui-clone.c
> +++ b/ui-clone.c
> @@ -17,7 +17,7 @@ static int print_ref_info(const char *refname, const struct object_id *oid,
>  {
>  	struct object *obj;
>  
> -	if (!(obj = parse_object(oid->hash)))
> +	if (!(obj = parse_object(oid)))
>  		return 0;
>  
>  	htmlf("%s\t%s\n", oid_to_hex(oid), refname);
> diff --git a/ui-commit.c b/ui-commit.c
> index db69d54..e1d4a9b 100644
> --- a/ui-commit.c
> +++ b/ui-commit.c
> @@ -31,7 +31,7 @@ void cgit_print_commit(char *hex, const char *prefix)
>  				"Bad object id: %s", hex);
>  		return;
>  	}
> -	commit = lookup_commit_reference(oid.hash);
> +	commit = lookup_commit_reference(&oid);
>  	if (!commit) {
>  		cgit_print_error_page(404, "Not found",
>  				"Bad commit reference: %s", hex);
> @@ -87,7 +87,7 @@ void cgit_print_commit(char *hex, const char *prefix)
>  	free(tmp);
>  	html("</td></tr>\n");
>  	for (p = commit->parents; p; p = p->next) {
> -		parent = lookup_commit_reference(p->item->object.oid.hash);
> +		parent = lookup_commit_reference(&p->item->object.oid);
>  		if (!parent) {
>  			html("<tr><td colspan='3'>");
>  			cgit_print_error("Error reading parent commit");
> diff --git a/ui-diff.c b/ui-diff.c
> index 173d351..3d40876 100644
> --- a/ui-diff.c
> +++ b/ui-diff.c
> @@ -407,7 +407,7 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
>  			"Bad object name: %s", new_rev);
>  		return;
>  	}
> -	commit = lookup_commit_reference(new_rev_oid->hash);
> +	commit = lookup_commit_reference(new_rev_oid);
>  	if (!commit || parse_commit(commit)) {
>  		cgit_print_error_page(404, "Not found",
>  			"Bad commit: %s", oid_to_hex(new_rev_oid));
> @@ -428,7 +428,7 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
>  	}
>  
>  	if (!is_null_oid(old_rev_oid)) {
> -		commit2 = lookup_commit_reference(old_rev_oid->hash);
> +		commit2 = lookup_commit_reference(old_rev_oid);
>  		if (!commit2 || parse_commit(commit2)) {
>  			cgit_print_error_page(404, "Not found",
>  				"Bad commit: %s", oid_to_hex(old_rev_oid));
> diff --git a/ui-patch.c b/ui-patch.c
> index 047e2f9..69aa4a8 100644
> --- a/ui-patch.c
> +++ b/ui-patch.c
> @@ -33,7 +33,7 @@ void cgit_print_patch(const char *new_rev, const char *old_rev,
>  				"Bad object id: %s", new_rev);
>  		return;
>  	}
> -	commit = lookup_commit_reference(new_rev_oid.hash);
> +	commit = lookup_commit_reference(&new_rev_oid);
>  	if (!commit) {
>  		cgit_print_error_page(404, "Not found",
>  				"Bad commit reference: %s", new_rev);
> @@ -46,7 +46,7 @@ void cgit_print_patch(const char *new_rev, const char *old_rev,
>  					"Bad object id: %s", old_rev);
>  			return;
>  		}
> -		if (!lookup_commit_reference(old_rev_oid.hash)) {
> +		if (!lookup_commit_reference(&old_rev_oid)) {
>  			cgit_print_error_page(404, "Not found",
>  					"Bad commit reference: %s", old_rev);
>  			return;
> diff --git a/ui-plain.c b/ui-plain.c
> index 8d541e3..e45d553 100644
> --- a/ui-plain.c
> +++ b/ui-plain.c
> @@ -185,7 +185,7 @@ void cgit_print_plain(void)
>  		cgit_print_error_page(404, "Not found", "Not found");
>  		return;
>  	}
> -	commit = lookup_commit_reference(oid.hash);
> +	commit = lookup_commit_reference(&oid);
>  	if (!commit || parse_commit(commit)) {
>  		cgit_print_error_page(404, "Not found", "Not found");
>  		return;
> diff --git a/ui-snapshot.c b/ui-snapshot.c
> index 9b8cddd..b2d95f7 100644
> --- a/ui-snapshot.c
> +++ b/ui-snapshot.c
> @@ -116,7 +116,7 @@ static int make_snapshot(const struct cgit_snapshot_format *format,
>  				"Bad object id: %s", hex);
>  		return 1;
>  	}
> -	if (!lookup_commit_reference(oid.hash)) {
> +	if (!lookup_commit_reference(&oid)) {
>  		cgit_print_error_page(400, "Bad request",
>  				"Not a commit reference: %s", hex);
>  		return 1;
> diff --git a/ui-tag.c b/ui-tag.c
> index afd7d61..909cde0 100644
> --- a/ui-tag.c
> +++ b/ui-tag.c
> @@ -54,7 +54,7 @@ void cgit_print_tag(char *revname)
>  			"Bad tag reference: %s", revname);
>  		goto cleanup;
>  	}
> -	obj = parse_object(oid.hash);
> +	obj = parse_object(&oid);
>  	if (!obj) {
>  		cgit_print_error_page(500, "Internal server error",
>  			"Bad object id: %s", oid_to_hex(&oid));
> @@ -64,7 +64,7 @@ void cgit_print_tag(char *revname)
>  		struct tag *tag;
>  		struct taginfo *info;
>  
> -		tag = lookup_tag(oid.hash);
> +		tag = lookup_tag(&oid);
>  		if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) {
>  			cgit_print_error_page(500, "Internal server error",
>  				"Bad tag object: %s", revname);
> 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;
>  	}
>  
> -- 
> 2.9.3
> 
> _______________________________________________
> CGit mailing list
> CGit at lists.zx2c4.com
> https://lists.zx2c4.com/mailman/listinfo/cgit


  reply	other threads:[~2017-07-22 11:25 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08  2:18 [RFC PATCH 0/4] Add ui-blame whydoubt
2017-06-08  2:18 ` [RFC PATCH 1/4] git: update to v2.14 whydoubt
2017-07-22 11:25   ` john [this message]
2017-06-08  2:18 ` [RFC PATCH 2/4] ui-blame: create placeholder and links whydoubt
2017-07-22 11:31   ` john
2017-06-08  2:18 ` [RFC PATCH 3/4] ui-blame: create needed html_ntxt_noellipsis function whydoubt
2017-07-22 11:36   ` john
2017-06-08  2:18 ` [RFC PATCH 4/4] ui-blame: fill in the contents whydoubt
2017-07-05  8:32   ` list
2017-07-22 11:47   ` john
2017-06-08  9:00 ` [RFC PATCH 0/4] Add ui-blame list
2017-07-22 12:02 ` john
2017-08-05  0:23   ` dlcampbell
2017-08-05  0:57     ` whydoubt
2017-08-24 18:14       ` list
2017-08-31 13:05         ` whydoubt
2017-09-23  3:38 ` [RFCv2 PATCH 0/7] " whydoubt
2017-09-23  3:38   ` [RFCv2 PATCH 1/7] ui-blame: create enable-blame config item whydoubt
2017-09-23 15:46     ` john
2017-09-24  3:12       ` whydoubt
2017-09-23  3:38   ` [RFCv2 PATCH 2/7] ui-blame: create framework whydoubt
2017-09-23 15:47     ` john
2017-09-24  3:24       ` whydoubt
2017-09-23  3:38   ` [RFCv2 PATCH 3/7] ui-blame: create links whydoubt
2017-09-23 15:47     ` john
2017-09-24 20:25       ` whydoubt
2017-09-23  3:38   ` [RFCv2 PATCH 4/7] ui-blame: html_ntxt with no ellipsis whydoubt
2017-09-23 15:47     ` john
2017-09-23  3:38   ` [RFCv2 PATCH 5/7] ui-blame: pull blame info from libgit whydoubt
2017-09-23 15:47     ` john
2017-09-24 19:06       ` whydoubt
2017-09-24 20:09         ` whydoubt
2017-09-24 20:52           ` john
2017-09-23  3:38   ` [RFCv2 PATCH 6/7] ui-blame: begin building whydoubt
2017-09-23  3:38   ` [RFCv2 PATCH 7/7] ui-blame: generate blame page when requested whydoubt
2017-09-23 15:53   ` [RFCv2 PATCH 0/7] Add ui-blame john
2017-09-24  3:05     ` whydoubt
2017-09-27 22:43   ` [PATCH 0/5] " whydoubt
2017-09-27 22:43     ` [PATCH 1/5] html: html_ntxt with no ellipsis whydoubt
2017-09-30 11:55       ` john
2017-09-27 22:43     ` [PATCH 2/5] ui-tree: move set_title_from_path to ui-shared whydoubt
2017-09-30 11:56       ` john
2017-09-27 22:43     ` [PATCH 3/5] ui-shared: make a char* parameter const whydoubt
2017-09-30 12:00       ` john
2017-09-27 22:43     ` [PATCH 4/5] ui-blame: add blame UI whydoubt
2017-09-30 12:07       ` john
2017-09-27 22:43     ` [PATCH 5/5] ui-tree: link to blame UI if enabled whydoubt
2017-09-30 12:08       ` john
2017-09-30 12:10     ` [PATCH 0/5] Add ui-blame john
2017-10-02  1:17       ` Jason
2017-10-02  5:34         ` list
2017-10-02 22:35           ` whydoubt
2017-10-02 23:29             ` list
2017-10-03 18:22               ` john
2017-10-03 18:23                 ` Jason
2017-10-03 18:36                   ` Jason
2017-10-03 19:06                     ` whydoubt
2017-10-02  4:39     ` [PATCHv2 " whydoubt
2017-10-02  4:39       ` [PATCHv2 1/5] html: html_ntxt with no ellipsis whydoubt
2017-10-02  4:39       ` [PATCHv2 2/5] ui-tree: move set_title_from_path to ui-shared whydoubt
2017-10-02  4:39       ` [PATCHv2 3/5] ui-shared: make a char* parameter const whydoubt
2017-10-02  4:39       ` [PATCHv2 4/5] ui-blame: add blame UI whydoubt
2017-10-02  4:39       ` [PATCHv2 5/5] ui-tree: link to blame UI if enabled whydoubt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170722112511.GE1600@john.keeping.me.uk \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).