public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: "brian m. carlson" <sandals@crustytoothpaste•net>
Cc: git@vger•kernel.org, "Jeff King" <peff@peff•net>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail•com>
Subject: Re: [PATCH v3 14/20] sha1-array: convert internal storage for struct sha1_array to object_id
Date: Fri, 31 Mar 2017 08:42:17 -0700	[thread overview]
Message-ID: <xmqqefxd1mhy.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20170331014001.953484-15-sandals@crustytoothpaste.net> (brian m. carlson's message of "Fri, 31 Mar 2017 01:39:55 +0000")

"brian m. carlson" <sandals@crustytoothpaste•net> writes:

>  	for (i = 0; i < array->nr; i++) {
> -		strbuf_addstr(&joined_hexs, sha1_to_hex(array->sha1[i]));
> +		strbuf_addstr(&joined_hexs, oid_to_hex(array->oid + i));

As I said in the previous round (in my comment on the one that
corresponds to the next patch, which has been updated in this
round), this converts E1[E2] to E1 + E2.

> @@ -621,7 +621,7 @@ static void bisect_rev_setup(struct rev_info *revs, const char *prefix,
>  	argv_array_pushf(&rev_argv, bad_format, oid_to_hex(current_bad_oid));
>  	for (i = 0; i < good_revs.nr; i++)
>  		argv_array_pushf(&rev_argv, good_format,
> -				 sha1_to_hex(good_revs.sha1[i]));
> +				 oid_to_hex(good_revs.oid + i));

Likewise.

> @@ -715,9 +715,9 @@ static struct commit **get_bad_and_good_commits(int *rev_nr)
>  	int i, n = 0;
>  
>  	ALLOC_ARRAY(rev, 1 + good_revs.nr);
> -	rev[n++] = get_commit_reference(current_bad_oid->hash);
> +	rev[n++] = get_commit_reference(current_bad_oid);
>  	for (i = 0; i < good_revs.nr; i++)
> -		rev[n++] = get_commit_reference(good_revs.sha1[i]);
> +		rev[n++] = get_commit_reference(good_revs.oid + i);
>  	*rev_nr = n;

Likewise.

> @@ -53,9 +53,9 @@ int sha1_array_for_each_unique(struct sha1_array *array,
>  
>  	for (i = 0; i < array->nr; i++) {
>  		int ret;
> -		if (i > 0 && !hashcmp(array->sha1[i], array->sha1[i-1]))
> +		if (i > 0 && !oidcmp(array->oid + i, array->oid + i - 1))
>  			continue;

Likewise.

> diff --git a/shallow.c b/shallow.c
> index 11f7dde9d9..dc7b67a294 100644
> --- a/shallow.c
> +++ b/shallow.c
> @@ -273,7 +273,7 @@ static int write_shallow_commits_1(struct strbuf *out, int use_pack_protocol,
>  	if (!extra)
>  		return data.count;
>  	for (i = 0; i < extra->nr; i++) {
> -		strbuf_addstr(out, sha1_to_hex(extra->sha1[i]));
> +		strbuf_addstr(out, oid_to_hex(extra->oid + i));
>  		strbuf_addch(out, '\n');
>  		data.count++;
>  	}

Likewise.

> @@ -417,13 +417,13 @@ void clear_shallow_info(struct shallow_info *info)
>  
>  void remove_nonexistent_theirs_shallow(struct shallow_info *info)
>  {
> -	unsigned char (*sha1)[20] = info->shallow->sha1;
> +	struct object_id *oid = info->shallow->oid;
>  	int i, dst;
>  	trace_printf_key(&trace_shallow, "shallow: remove_nonexistent_theirs_shallow\n");
>  	for (i = dst = 0; i < info->nr_theirs; i++) {
>  		if (i != dst)
>  			info->theirs[dst] = info->theirs[i];
> -		if (has_sha1_file(sha1[info->theirs[i]]))
> +		if (has_object_file(oid + info->theirs[i]))
>  			dst++;
>  	}
>  	info->nr_theirs = dst;

Likewise.

It is so minor that there is no point rerolling the whole thing only
for these, though.

Thanks.


  reply	other threads:[~2017-03-31 15:42 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31  1:39 [PATCH v3 00/20] object_id part 7 brian m. carlson
2017-03-31  1:39 ` [PATCH v3 01/20] Define new hash-size constants for allocating memory brian m. carlson
2017-03-31  1:39 ` [PATCH v3 02/20] Convert GIT_SHA1_HEXSZ used for allocation to GIT_MAX_HEXSZ brian m. carlson
2017-03-31  1:39 ` [PATCH v3 03/20] Convert GIT_SHA1_RAWSZ used for allocation to GIT_MAX_RAWSZ brian m. carlson
2017-03-31  1:39 ` [PATCH v3 04/20] builtin/diff: convert to struct object_id brian m. carlson
2017-03-31  1:39 ` [PATCH v3 05/20] builtin/pull: convert portions " brian m. carlson
2017-03-31  1:39 ` [PATCH v3 06/20] builtin/receive-pack: " brian m. carlson
2017-07-15 18:33   ` René Scharfe
2017-03-31  1:39 ` [PATCH v3 07/20] fsck: convert init_skiplist " brian m. carlson
2017-03-31  1:39 ` [PATCH v3 08/20] parse-options-cb: convert sha1_array_append caller " brian m. carlson
2017-03-31  1:39 ` [PATCH v3 09/20] test-sha1-array: convert most code " brian m. carlson
2017-03-31  1:39 ` [PATCH v3 10/20] sha1_name: convert struct disambiguate_state to object_id brian m. carlson
2017-03-31  1:39 ` [PATCH v3 11/20] sha1_name: convert disambiguate_hint_fn to take object_id brian m. carlson
2017-03-31  1:39 ` [PATCH v3 12/20] submodule: convert check_for_new_submodule_commits to object_id brian m. carlson
2017-03-31  1:39 ` [PATCH v3 13/20] builtin/pull: convert to struct object_id brian m. carlson
2017-03-31  1:39 ` [PATCH v3 14/20] sha1-array: convert internal storage for struct sha1_array to object_id brian m. carlson
2017-03-31 15:42   ` Junio C Hamano [this message]
2017-03-31  1:39 ` [PATCH v3 15/20] Make sha1_array_append take a struct object_id * brian m. carlson
2017-03-31  1:39 ` [PATCH v3 16/20] Convert remaining callers of sha1_array_lookup to object_id brian m. carlson
2017-03-31  1:39 ` [PATCH v3 17/20] Convert sha1_array_lookup to take struct object_id brian m. carlson
2017-03-31  1:39 ` [PATCH v3 18/20] Convert sha1_array_for_each_unique and for_each_abbrev to object_id brian m. carlson
2017-03-31  1:40 ` [PATCH v3 19/20] Rename sha1_array to oid_array brian m. carlson
2017-03-31  1:40 ` [PATCH v3 20/20] Documentation: update and rename api-sha1-array.txt brian m. carlson
2017-03-31 15:46 ` [PATCH v3 00/20] object_id part 7 Junio C Hamano

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=xmqqefxd1mhy.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=pclouds@gmail$(echo .)com \
    --cc=peff@peff$(echo .)net \
    --cc=sandals@crustytoothpaste$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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