Re: [PATCH 3/8] git-repack --max-pack-size: make close optional in sha1close()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dana How <danahow@xxxxxxxxx> 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.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]