[sheepdog] [PATCH v3 06/12] collie/farm: implement sha1_file

Kai Zhang kyle at zelin.io
Wed May 15 09:20:40 CEST 2013


On May 14, 2013, at 11:57 PM, MORITA Kazutaka <morita.kazutaka at gmail.com> wrote:

> At Tue, 14 May 2013 15:51:51 +0800,
> Kai Zhang wrote:
>> 
>> moved sha1_file from sheep/farm to collie/farm and made minor modification.
>> 
>> Signed-off-by: Kai Zhang <kyle at zelin.io>
>> ---
>> collie/Makefile.am      |    2 +-
>> collie/farm/farm.c      |   24 ++++
>> collie/farm/farm.h      |   23 ++++
>> collie/farm/sha1_file.c |  273 +++++++++++++++++++++++++++++++++++++++++++++++
>> 4 files changed, 321 insertions(+), 1 deletions(-)
>> create mode 100644 collie/farm/farm.c
>> create mode 100644 collie/farm/sha1_file.c
> 
> Can you delete sheep/farm/*.c and create collie/farm/*.c in the same commit, and
> use 'git format-patch -M' to generate a patch?  Then, git detects renames and
> your 'minor modification' will be clearer.
> 

I have tried this. But it seems that contents of the patch file is badly organised and hard to be understood.
It doesn't help to review this patch.

I think it would be better to explain the way of implementation and the modifications clearly in the commit message.
I will and more explanation in next version.

However, I would like to do anything which helps you review this patch.

>> +
>> +char *sha1_to_hex(const unsigned char *sha1)
>> +{
>> +	static char buffer[50];
>> +	static const char hex[] = "0123456789abcdef";
>> +	char *buf = buffer;
>> +	int i;
>> +
>> +	for (i = 0; i < SHA1_LEN; i++) {
>> +		unsigned int val = *sha1++;
>> +		*buf++ = hex[val >> 4];
>> +		*buf++ = hex[val & 0xf];
>> +	}
>> +	return buffer;
>> +}
> 
> sha1_to_hex() is now defined in lib/sha1.c.  Maybe, you need to rebase your
> series onto the current master?
> 

I will fixed this in the next version.

Thanks,
Kyle




More information about the sheepdog mailing list