git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: "Git List" <git@vger.kernel.org>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	"Patryk Obara" <patryk.obara@gmail.com>,
	"Jeff King" <peff@peff.net>
Subject: Re: [PATCH 09/12] read-cache: abstract away uses of SHA-1
Date: Sun, 28 Jan 2018 14:50:18 -0500	[thread overview]
Message-ID: <CAPig+cQ6UZJh5sZJURTiZ+T8eV8pyBSMTM8Re-BN7ZVwGc60+A@mail.gmail.com> (raw)
In-Reply-To: <20180128155722.880805-10-sandals@crustytoothpaste.net>

On Sun, Jan 28, 2018 at 10:57 AM, brian m. carlson
<sandals@crustytoothpaste.net> wrote:
> Convert various uses of direct calls to SHA-1 and 20- and 40-based
> constants to use the_hash_algo instead.  Don't yet convert the on-disk
> data structures, which will be handled in a future commit.
>
> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
> ---
> diff --git a/read-cache.c b/read-cache.c
> @@ -2000,26 +2000,26 @@ static int write_index_ext_header(git_SHA_CTX *context, int fd,
>         /* Flush first if not enough space for SHA1 signature */

Did you want to update the comment to remove the SHA1 reference also?
(Or was the omission intentional per the commit message?)

> -       if (left + 20 > WRITE_BUFFER_SIZE) {
> +       if (left + the_hash_algo->rawsz > WRITE_BUFFER_SIZE) {
>                 if (write_in_full(fd, write_buffer, left) < 0)
>                         return -1;
>                 left = 0;
>         }
>
>         /* Append the SHA1 signature at the end */

Ditto.

> -       git_SHA1_Final(write_buffer + left, context);
> -       hashcpy(sha1, write_buffer + left);
> -       left += 20;
> +       the_hash_algo->final_fn(write_buffer + left, context);
> +       hashcpy(hash, write_buffer + left);
> +       left += the_hash_algo->rawsz;

  reply	other threads:[~2018-01-28 19:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-28 15:57 [PATCH 00/12] object_id part 11 (the_hash_algo) brian m. carlson
2018-01-28 15:57 ` [PATCH 01/12] hash: move SHA-1 macros to hash.h brian m. carlson
2018-01-28 15:57 ` [PATCH 02/12] hash: create union for hash context allocation brian m. carlson
2018-01-28 19:57   ` Patryk Obara
2018-01-28 20:16     ` brian m. carlson
2018-01-28 15:57 ` [PATCH 03/12] builtin/index-pack: improve hash function abstraction brian m. carlson
2018-01-28 15:57 ` [PATCH 04/12] builtin/unpack-objects: switch uses of SHA-1 to the_hash_algo brian m. carlson
2018-01-28 15:57 ` [PATCH 05/12] sha1_file: " brian m. carlson
2018-01-28 15:57 ` [PATCH 06/12] fast-import: switch various " brian m. carlson
2018-01-28 20:10   ` Patryk Obara
2018-01-28 15:57 ` [PATCH 07/12] pack-check: convert various uses of SHA-1 to abstract forms brian m. carlson
2018-01-28 15:57 ` [PATCH 08/12] pack-write: switch various SHA-1 values " brian m. carlson
2018-01-28 20:30   ` Patryk Obara
2018-01-28 21:52     ` brian m. carlson
2018-01-28 15:57 ` [PATCH 09/12] read-cache: abstract away uses of SHA-1 brian m. carlson
2018-01-28 19:50   ` Eric Sunshine [this message]
2018-01-28 20:10     ` brian m. carlson
2018-01-28 15:57 ` [PATCH 10/12] csum-file: rename sha1file to hashfile brian m. carlson
2018-01-28 15:57 ` [PATCH 11/12] csum-file: abstract uses of SHA-1 brian m. carlson
2018-01-28 15:57 ` [PATCH 12/12] bulk-checkin: abstract SHA-1 usage brian m. carlson
2018-01-28 20:48 ` [PATCH 00/12] object_id part 11 (the_hash_algo) Patryk Obara
2018-01-28 22:00   ` 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

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

  git send-email \
    --in-reply-to=CAPig+cQ6UZJh5sZJURTiZ+T8eV8pyBSMTM8Re-BN7ZVwGc60+A@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=git@vger.kernel.org \
    --cc=patryk.obara@gmail.com \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    --cc=sandals@crustytoothpaste.net \
    /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).