[darcs-users] New patch name format details?

David Roundy droundy at abridgegame.org
Wed Nov 19 13:30:04 UTC 2003


On Tue, Nov 18, 2003 at 09:05:30PM -0800, Kevin Smith wrote:
> I'm struggling a little trying to understand exactly what goes in to a 
> new-format patch filename. Here's the code from PatchInfo.lhs:
...
> So we have the date as YYYYMMDDHHMMSS, then the first five characters of 
> a string representation of the sha1 of the author name, then the full 
> sha1 of: the patch name (nps) and the patch author (aps) and the patch 
> date (dps) and the patch log.

Correct.

> I tried to get the same value for author name, using sha1sum. The couple 
> test cases I tried (with "David Roundy <droundy at abridgegame.org>") gave 
> different results from the corresponding patch file name. Do I need to 
> append something to the end?

Hmmmm.  Could be you've accidentally added a newline? I just verified for
Peter's email:

% echo -n "peter at zarquon.se" | sha1sum
3eba368e5e41bd1fdd8908544348a6b69a566a69

% zgrep "peter at zarquon.se" *.gz
20030708011043-3eba3-32fd2310cb2c87e7dfe0008c4dd6a9c55447fd38.gz

> Can you describe the format that the date is in at the point it is added 
> to the string to be hashed?

It is in whatever format it is stored in in the PatchInfo.  For new
patches, this is the same YYYYMMDDHHMMSS format.  For old patches, it was
determined by your locale.

> Exactly what string would be used for a log entry that has a one-liner 
> plus a couple lines of long entries? Does it include everything inside 
> the square brackets? Does it include the square brackets? Is it assumed 
> to be normalized to LF only for newlines?

It doesn't include either brackets or newlines.  Just the contents of each
line of log.  That's what the concat l gives you.  If I had thought about
it a bit more, I would have probably added in the newlines, but if you have
two patches that differ only in the newlines in the log, you've got a
pretty strange setup anyways...

> Is there any place in the code that does verifies the hash yet? If not, 
> that would eventually be a nice sanity check for each patch file.

No, there isn't.  That would be reasonable to add... on the other hand,
although darcs check doesn't verify that the content of a patch file
matches its hash, it does verify that the hash matches the copy of the
patch id in inventory.
-- 
David Roundy
http://www.abridgegame.org




More information about the darcs-users mailing list