-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Implement support for Git hashing with SHA-256 #13543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| 100644 blob ce60f5ad78a08ac24872ef74d78b078f077be212e7a246893a1a5d957dfbc8b1 Foo | ||
| 100755 blob ce60f5ad78a08ac24872ef74d78b078f077be212e7a246893a1a5d957dfbc8b1 bAr | ||
| 040000 tree 6ef19b41225c5369f1c104d45d8d85efa9b057b53b14b4b9b939dd74decc5321 baZ | ||
| 120000 blob ce60f5ad78a08ac24872ef74d78b078f077be212e7a246893a1a5d957dfbc8b1 quuX |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,23 +20,6 @@ | |
|
|
||
| namespace nix { | ||
|
|
||
| static size_t regularHashSize(HashAlgorithm type) | ||
| { | ||
| switch (type) { | ||
| case HashAlgorithm::BLAKE3: | ||
| return blake3HashSize; | ||
| case HashAlgorithm::MD5: | ||
| return md5HashSize; | ||
| case HashAlgorithm::SHA1: | ||
| return sha1HashSize; | ||
| case HashAlgorithm::SHA256: | ||
| return sha256HashSize; | ||
| case HashAlgorithm::SHA512: | ||
| return sha512HashSize; | ||
| } | ||
| unreachable(); | ||
| } | ||
|
|
||
| const StringSet hashAlgorithms = {"blake3", "md5", "sha1", "sha256", "sha512"}; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe the supported git hash algorithms could be defined as subset of
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I understand what you are saying, and it makes sense to me. (Enum > string, for sure.) Would you like to make a PR for this? :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
looks like a good point to work myself into the codebase. Hope I don't forget about it when I find the time |
||
|
|
||
| const StringSet hashFormats = {"base64", "nix32", "base16", "sri"}; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious, why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh
ASSERTwill end the test if it fails, whileEXPECTwill register a failure but keep on going. The two loops are independent (really should be two separate tests, but I didn't want more macros), soEXPECTis better in this case.