git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Derrick Stolee <dstolee@microsoft.com>
To: git@vger.kernel.org
Cc: stolee@gmail.com, jonathantanmy@google.com, sandals@crustytoothpaste.net
Subject: [PATCH v2 1/3] sha1_name: convert struct min_abbrev_data to object_id
Date: Thu, 22 Mar 2018 13:40:08 -0400	[thread overview]
Message-ID: <20180322174010.120117-2-dstolee@microsoft.com> (raw)
In-Reply-To: <20180322174010.120117-1-dstolee@microsoft.com>

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

This structure is only written to in one place, where we already have a
struct object_id.  Convert the struct to use a struct object_id instead.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 sha1_name.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sha1_name.c b/sha1_name.c
index 39e911c8ba..16e0003396 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -480,7 +480,7 @@ struct min_abbrev_data {
 	unsigned int init_len;
 	unsigned int cur_len;
 	char *hex;
-	const unsigned char *hash;
+	const struct object_id *oid;
 };
 
 static inline char get_hex_char_from_oid(const struct object_id *oid,
@@ -526,7 +526,7 @@ static void find_abbrev_len_for_pack(struct packed_git *p,
 		int cmp;
 
 		current = nth_packed_object_sha1(p, mid);
-		cmp = hashcmp(mad->hash, current);
+		cmp = hashcmp(mad->oid->hash, current);
 		if (!cmp) {
 			match = 1;
 			first = mid;
@@ -603,7 +603,7 @@ int find_unique_abbrev_r(char *hex, const struct object_id *oid, int len)
 	mad.init_len = len;
 	mad.cur_len = len;
 	mad.hex = hex;
-	mad.hash = oid->hash;
+	mad.oid = oid;
 
 	find_abbrev_len_packed(&mad);
 

base-commit: 1a750441a7360b29fff7a414649ece1d35acaca6
-- 
2.17.0.rc0


  reply	other threads:[~2018-03-22 17:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-20 20:03 [PATCH] sha1_name: use bsearch_hash() for abbreviations Derrick Stolee
2018-03-20 22:25 ` Jonathan Tan
2018-03-21 13:24   ` Derrick Stolee
2018-03-21 22:42     ` brian m. carlson
2018-03-22 17:40       ` [PATCH v2 0/3] Use " Derrick Stolee
2018-03-22 17:40         ` Derrick Stolee [this message]
2018-03-22 17:40         ` [PATCH v2 2/3] packfile: define and use bsearch_pack() Derrick Stolee
2018-03-22 17:40         ` [PATCH v2 3/3] sha1_name: use bsearch_pack() for abbreviations Derrick Stolee
2018-03-24 16:41         ` [PATCH 4/3] sha1_name: use bsearch_pack() in unique_in_pack() René Scharfe
2018-03-25 16:19           ` Junio C Hamano
2018-03-25 16:32             ` René Scharfe
2018-03-25 18:21           ` Derrick Stolee

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20180322174010.120117-2-dstolee@microsoft.com \
    --to=dstolee@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=jonathantanmy@google.com \
    --cc=sandals@crustytoothpaste.net \
    --cc=stolee@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).