public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce•org>
To: Dana How <danahow@gmail•com>
Cc: Junio C Hamano <junkio@cox•net>, Git Mailing List <git@vger•kernel.org>
Subject: Re: [PATCH 3/8] git-repack --max-pack-size: make close optional in sha1close()
Date: Tue, 1 May 2007 01:01:56 -0400	[thread overview]
Message-ID: <20070501050155.GY5942@spearce.org> (raw)
In-Reply-To: <463679AE.7020106@gmail.com>

Dana How <danahow@gmail•com> wrote:
> sha1close() flushes, writes checksum, and closes.
> The 2nd can be suppressed; make the last suppressible as well.
...
> diff --git a/csum-file.c b/csum-file.c
> index 7c806ad..993c899 100644
> --- a/csum-file.c
> +++ b/csum-file.c
> @@ -35,7 +35,10 @@ int sha1close(struct sha1file *f, unsigned char *result, int update)
>  	if (offset) {
>  		SHA1_Update(&f->ctx, f->buffer, offset);
>  		sha1flush(f, offset);
> +		f->offset = 0;
>  	}
> +	if (update < 0)
> +		return 0;	/* only want to flush (no checksum write, no close) */
>  	SHA1_Final(f->buffer, &f->ctx);
>  	if (result)
>  		hashcpy(result, f->buffer);

Huh.  Nobody currently uses that update parameter; all current in-tree
callers (which better be *all* callers since we don't have a true
libgit!) seem to always pass a 1 for this argument.  This makes the
later:

  if (update)
    sha1flush(f, 20);

always true anytime sha1close is called.  Maybe we should be
redefining that update argument to be 1 means do all work, 0 means
return where you return update < 0 above?

-- 
Shawn.

  reply	other threads:[~2007-05-01  5:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-30 23:20 [PATCH 3/8] git-repack --max-pack-size: make close optional in sha1close() Dana How
2007-05-01  5:01 ` Shawn O. Pearce [this message]
2007-05-01  5:24   ` Dana How
  -- strict thread matches above, loose matches on Subject: below --
2007-04-08 23:21 Dana How

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=20070501050155.GY5942@spearce.org \
    --to=spearce@spearce$(echo .)org \
    --cc=danahow@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=junkio@cox$(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