[PATCH 1/1] RFC: git: update to v2.10.0-rc0

John Keeping john at keeping.me.uk
Mon Aug 15 10:47:29 CEST 2016


On Mon, Aug 15, 2016 at 10:13:19AM +0200, Christian Hesse wrote:
> From: Christian Hesse <mail at eworm.de>
> 
> Upstream continues to replace unsigned char *sha1 with struct
> object_id old_oid. This makes the required changes.
> 
> The upstream declaration of main function changed, resulting in
> error: Multiple definition of `main'.
> An additional patch for git is required:
> http://marc.info/?l=git&m=147124808824901&w=2
> 
> Signed-off-by: Christian Hesse <mail at eworm.de>
> ---
> diff --git a/ui-diff.c b/ui-diff.c
> index edee793..0819919 100644
> --- a/ui-diff.c
> +++ b/ui-diff.c
> @@ -170,8 +170,8 @@ static void inspect_filepair(struct diff_filepair *pair)
>  		items = xrealloc(items, slots * sizeof(struct fileinfo));
>  	}
>  	items[files-1].status = pair->status;
> -	hashcpy(items[files-1].old_sha1, pair->one->sha1);
> -	hashcpy(items[files-1].new_sha1, pair->two->sha1);
> +	hashcpy(items[files-1].old_sha1, pair->one->oid.hash);
> +	hashcpy(items[files-1].new_sha1, pair->two->oid.hash);

oidcpy?

>  	items[files-1].old_mode = pair->one->mode;
>  	items[files-1].new_mode = pair->two->mode;
>  	items[files-1].old_path = xstrdup(pair->one->path);
> @@ -402,36 +402,36 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
>  
>  	if (!new_rev)
>  		new_rev = ctx.qry.head;
> -	if (get_sha1(new_rev, new_rev_sha1)) {
> +	if (get_oid(new_rev, new_rev_oid)) {
>  		cgit_print_error_page(404, "Not found",
>  			"Bad object name: %s", new_rev);
>  		return;
>  	}
> -	commit = lookup_commit_reference(new_rev_sha1);
> +	commit = lookup_commit_reference(new_rev_oid->hash);
>  	if (!commit || parse_commit(commit)) {
>  		cgit_print_error_page(404, "Not found",
> -			"Bad commit: %s", sha1_to_hex(new_rev_sha1));
> +			"Bad commit: %s", oid_to_hex(new_rev_oid));
>  		return;
>  	}
>  	new_tree_sha1 = commit->tree->object.oid.hash;
>  
>  	if (old_rev) {
> -		if (get_sha1(old_rev, old_rev_sha1)) {
> +		if (get_oid(old_rev, old_rev_oid)) {
>  			cgit_print_error_page(404, "Not found",
>  				"Bad object name: %s", old_rev);
>  			return;
>  		}
>  	} else if (commit->parents && commit->parents->item) {
> -		hashcpy(old_rev_sha1, commit->parents->item->object.oid.hash);
> +		hashcpy(old_rev_oid->hash, commit->parents->item->object.oid.hash);

oidcpy?

>  	} else {
> -		hashclr(old_rev_sha1);
> +		hashclr(old_rev_oid->hash);

oidclr?

>  	}
>  
> -	if (!is_null_sha1(old_rev_sha1)) {
> -		commit2 = lookup_commit_reference(old_rev_sha1);
> +	if (!is_null_oid(old_rev_oid)) {
> +		commit2 = lookup_commit_reference(old_rev_oid->hash);
>  		if (!commit2 || parse_commit(commit2)) {
>  			cgit_print_error_page(404, "Not found",
> -				"Bad commit: %s", sha1_to_hex(old_rev_sha1));
> +				"Bad commit: %s", oid_to_hex(old_rev_oid));
>  			return;
>  		}
>  		old_tree_sha1 = commit2->tree->object.oid.hash;


More information about the CGit mailing list