git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: <git@vger.kernel.org>
Cc: "Eric Sunshine" <sunshine@sunshineco.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"René Scharfe" <l.s.r@web.de>, "Jeff King" <peff@peff.net>
Subject: [PATCH v2 21/35] http-walker: replace sha1_to_hex
Date: Tue, 19 Feb 2019 00:05:12 +0000	[thread overview]
Message-ID: <20190219000526.476553-22-sandals@crustytoothpaste.net> (raw)
In-Reply-To: <20190219000526.476553-1-sandals@crustytoothpaste.net>

Since sha1_to_hex is limited to SHA-1, replace the uses of it in this
file with hash_to_hex.  Rename several variables accordingly to reflect
that they are no longer limited to SHA-1.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 http-walker.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/http-walker.c b/http-walker.c
index 8063896cf6..e11670eee2 100644
--- a/http-walker.c
+++ b/http-walker.c
@@ -434,9 +434,9 @@ static int http_fetch_pack(struct walker *walker, struct alt_base *repo, unsigne
 
 	if (walker->get_verbosely) {
 		fprintf(stderr, "Getting pack %s\n",
-			sha1_to_hex(target->hash));
+			hash_to_hex(target->hash));
 		fprintf(stderr, " which contains %s\n",
-			sha1_to_hex(sha1));
+			hash_to_hex(sha1));
 	}
 
 	preq = new_http_pack_request(target, repo->base);
@@ -473,9 +473,9 @@ static void abort_object_request(struct object_request *obj_req)
 	release_object_request(obj_req);
 }
 
-static int fetch_object(struct walker *walker, unsigned char *sha1)
+static int fetch_object(struct walker *walker, unsigned char *hash)
 {
-	char *hex = sha1_to_hex(sha1);
+	char *hex = hash_to_hex(hash);
 	int ret = 0;
 	struct object_request *obj_req = NULL;
 	struct http_object_request *req;
@@ -483,7 +483,7 @@ static int fetch_object(struct walker *walker, unsigned char *sha1)
 
 	list_for_each(pos, head) {
 		obj_req = list_entry(pos, struct object_request, node);
-		if (hasheq(obj_req->oid.hash, sha1))
+		if (hasheq(obj_req->oid.hash, hash))
 			break;
 	}
 	if (obj_req == NULL)
@@ -557,20 +557,20 @@ static int fetch_object(struct walker *walker, unsigned char *sha1)
 	return ret;
 }
 
-static int fetch(struct walker *walker, unsigned char *sha1)
+static int fetch(struct walker *walker, unsigned char *hash)
 {
 	struct walker_data *data = walker->data;
 	struct alt_base *altbase = data->alt;
 
-	if (!fetch_object(walker, sha1))
+	if (!fetch_object(walker, hash))
 		return 0;
 	while (altbase) {
-		if (!http_fetch_pack(walker, altbase, sha1))
+		if (!http_fetch_pack(walker, altbase, hash))
 			return 0;
 		fetch_alternates(walker, data->alt->base);
 		altbase = altbase->next;
 	}
-	return error("Unable to find %s under %s", sha1_to_hex(sha1),
+	return error("Unable to find %s under %s", hash_to_hex(hash),
 		     data->alt->base);
 }
 

  parent reply	other threads:[~2019-02-19  0:06 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-19  0:04 [PATCH v2 00/35] Hash function transition part 16 brian m. carlson
2019-02-19  0:04 ` [PATCH v2 01/35] t/lib-submodule-update: use appropriate length constant brian m. carlson
2019-02-19  0:04 ` [PATCH v2 02/35] khash: move oid hash table definition brian m. carlson
2019-02-19  0:04 ` [PATCH v2 03/35] pack-bitmap: make bitmap header handling hash agnostic brian m. carlson
2019-02-19  0:04 ` [PATCH v2 04/35] pack-bitmap: convert struct stored_bitmap to object_id brian m. carlson
2019-02-19  0:04 ` [PATCH v2 05/35] pack-bitmap: replace sha1_to_hex brian m. carlson
2019-02-19  0:04 ` [PATCH v2 06/35] pack-bitmap: switch hard-coded constants to the_hash_algo brian m. carlson
2019-02-19  0:04 ` [PATCH v2 07/35] pack-bitmap: switch hash tables to use struct object_id brian m. carlson
2019-02-19  0:04 ` [PATCH v2 08/35] submodule: avoid hard-coded constants brian m. carlson
2019-02-19  0:05 ` [PATCH v2 09/35] notes-merge: switch to use the_hash_algo brian m. carlson
2019-02-19  0:05 ` [PATCH v2 10/35] notes: make hash size independent brian m. carlson
2019-02-19  0:05 ` [PATCH v2 11/35] notes: replace sha1_to_hex brian m. carlson
2019-02-19  0:05 ` [PATCH v2 12/35] object-store: rename and expand packed_git's sha1 member brian m. carlson
2019-02-19  0:05 ` [PATCH v2 13/35] builtin/name-rev: make hash-size independent brian m. carlson
2019-02-19  0:05 ` [PATCH v2 14/35] fast-import: " brian m. carlson
2019-02-19  0:05 ` [PATCH v2 15/35] fast-import: replace sha1_to_hex brian m. carlson
2019-02-19  0:05 ` [PATCH v2 16/35] builtin/am: make hash size independent brian m. carlson
2019-02-19  0:05 ` [PATCH v2 17/35] builtin/pull: make hash-size independent brian m. carlson
2019-02-19  0:05 ` [PATCH v2 18/35] http-push: convert to use the_hash_algo brian m. carlson
2019-02-19  0:05 ` [PATCH v2 19/35] http-backend: allow 64-character hex names brian m. carlson
2019-02-19  0:05 ` [PATCH v2 20/35] http-push: remove remaining uses of sha1_to_hex brian m. carlson
2019-02-19  0:05 ` brian m. carlson [this message]
2019-02-19  0:05 ` [PATCH v2 22/35] http: replace hard-coded constant with the_hash_algo brian m. carlson
2019-02-19  0:05 ` [PATCH v2 23/35] http: compute hash of downloaded objects using the_hash_algo brian m. carlson
2019-02-19  0:05 ` [PATCH v2 24/35] http: replace sha1_to_hex brian m. carlson
2019-02-19  0:05 ` [PATCH v2 25/35] remote-curl: make hash size independent brian m. carlson
2019-02-19  0:05 ` [PATCH v2 26/35] hash: add a function to lookup hash algorithm by length brian m. carlson
2019-02-19  0:05 ` [PATCH v2 27/35] get-tar-commit-id: parse comment record brian m. carlson
2019-02-19  0:05 ` [PATCH v2 28/35] builtin/get-tar-commit-id: make hash size independent brian m. carlson
2019-02-19  0:05 ` [PATCH v2 29/35] archive: convert struct archiver_args to object_id brian m. carlson
2019-02-19  0:05 ` [PATCH v2 30/35] refspec: make hash size independent brian m. carlson
2019-02-19  0:05 ` [PATCH v2 31/35] builtin/difftool: use parse_oid_hex brian m. carlson
2019-02-19  0:05 ` [PATCH v2 32/35] dir: make untracked cache extension hash size independent brian m. carlson
2019-02-19  0:05 ` [PATCH v2 33/35] read-cache: read data in a hash-independent way brian m. carlson
2019-02-19  0:05 ` [PATCH v2 34/35] Git.pm: make hash size independent brian m. carlson
2019-02-19  0:05 ` [PATCH v2 35/35] gitweb: " brian m. carlson

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=20190219000526.476553-22-sandals@crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=l.s.r@web.de \
    --cc=peff@peff.net \
    --cc=sunshine@sunshineco.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).