Re: [PATCH 02/15] builtin/hash-object: allow literally hashing with a given algorithm

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

 



On 2021-04-11 at 08:52:02, Ævar Arnfjörð Bjarmason wrote:
> 
> On Sat, Apr 10 2021, brian m. carlson wrote:
> 
> > +	algo = the_hash_algo;
> > +	if (object_format) {
> > +		if (flags & HASH_WRITE_OBJECT)
> > +			errstr = "Can't use -w with --object-format";
> > +		else {
> > +			int id = hash_algo_by_name(object_format);
> > +			if (id == GIT_HASH_UNKNOWN)
> > +				errstr = "Unknown object format";
> 
> An established pattern, but shouldn't these be N_()'d while we're at it?
> At least for new strings.

Sure, I can do that.

> > +			else
> > +				algo = &hash_algos[id];
> > +		}
> > +	}
> 
> Style nit: if .. {} else {} not if .. else {}.

Will fix.

> > +test_expect_success '--literally with --object-format' '
> > +	test $(test_oid --hash=sha1 hello) = $(git hash-object -t blob --literally --object-format=sha1 hello) &&
> > +	test $(test_oid --hash=sha256 hello) = $(git hash-object -t blob --literally --object-format=sha256 hello)
> > +'
> 
> This would be more readable and easier to debug with 4x tempfiles and 2x
> test_cmp.

Okay, I can go for that.
-- 
brian m. carlson (he/him or they/them)
Houston, Texas, US

Attachment: signature.asc
Description: PGP signature


[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]

  Powered by Linux