-
Notifications
You must be signed in to change notification settings - Fork 494
Add support for SHA-256 Git object IDs #3893
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 3 commits
6a4e35f
de3e561
a66f7bb
93d215d
3c8c0ae
e8d3fa2
b43bb7b
5b815f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -163,11 +163,12 @@ export const determineBaseBranchHeadCommitOid = async function ( | |
| } | ||
| } | ||
|
|
||
| // Let's confirm our assumptions: We had a merge commit and the parsed parent data looks correct | ||
| // Let's confirm our assumptions: We had a merge commit and the parsed parent | ||
| // data looks correct. OIDs are either 40 (SHA-1) or 64 (SHA-256) hex characters. | ||
| if ( | ||
| commitOid === mergeSha && | ||
| headOid.length === 40 && | ||
| baseOid.length === 40 | ||
| (headOid.length === 40 || headOid.length === 64) && | ||
| (baseOid.length === 40 || baseOid.length === 64) | ||
| ) { | ||
| return baseOid; | ||
| } | ||
|
|
@@ -296,7 +297,8 @@ export const getFileOidsUnderPath = async function ( | |
| // 100644 4c51bc1d9e86cd86e01b0f340cb8ce095c33b283 0\tsrc/git-utils.test.ts | ||
| // 100644 6b792ea543ce75d7a8a03df591e3c85311ecb64f 0\tsrc/git-utils.ts | ||
| // The fields are: <mode> <oid> <stage>\t<path> | ||
| const regex = /^[0-9]+ ([0-9a-f]{40}) [0-9]+\t(.+)$/; | ||
| // The OID is either 40 (SHA-1) or 64 (SHA-256) hex characters. | ||
| const regex = /^[0-9]+ ([0-9a-f]{40}|[0-9a-f]{64}) [0-9]+\t(.+)$/; | ||
|
Member
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. Nice, I think this is a cleaner approach than what was suggested on the other PR. |
||
| for (const line of stdout.split("\n")) { | ||
| if (line) { | ||
| const match = line.match(regex); | ||
|
|
||
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.
Minor: I don't think the
restorecall is needed since that should happen automatically.