summaryrefslogtreecommitdiff
path: root/examples/general.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2022-07-13 21:08:04 -0400
committerGitHub <noreply@github.com>2022-07-13 21:08:04 -0400
commit433a133402fae298f8ee7613bcfd997c2712d269 (patch)
tree17c4d0c86faaeae71f65d28cc0ba0d60b481a2ea /examples/general.c
parent21b70f09b4e3db188bf5e5813a9912ae89de355d (diff)
parent6013b6a0dc5897386bfc8db6e07447c055f2fd94 (diff)
downloadlibgit2-433a133402fae298f8ee7613bcfd997c2712d269.tar.gz
Merge pull request #6191 from libgit2/ethomson/sha256_poc
RFC: SHA256 proof of concept
Diffstat (limited to 'examples/general.c')
-rw-r--r--examples/general.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/examples/general.c b/examples/general.c
index 2127ec0e1..a84cdb755 100644
--- a/examples/general.c
+++ b/examples/general.c
@@ -129,7 +129,7 @@ int lg2_general(git_repository *repo, int argc, char** argv)
*/
static void oid_parsing(git_oid *oid)
{
- char out[GIT_OID_HEXSZ+1];
+ char out[GIT_OID_SHA1_HEXSIZE+1];
char hex[] = "4a202b346bb0fb0db7eff3cffeb3c70babbd2045";
printf("*Hex to Raw*\n");
@@ -142,7 +142,7 @@ static void oid_parsing(git_oid *oid)
* this throughout the example for storing the value of the current SHA
* key we're working with.
*/
- git_oid_fromstr(oid, hex);
+ git_oid_fromstr(oid, hex, GIT_OID_SHA1);
/*
* Once we've converted the string into the oid value, we can get the raw
@@ -152,7 +152,7 @@ static void oid_parsing(git_oid *oid)
* char hex value.
*/
printf("\n*Raw to Hex*\n");
- out[GIT_OID_HEXSZ] = '\0';
+ out[GIT_OID_SHA1_HEXSIZE] = '\0';
/**
* If you have a oid, you can easily get the hex value of the SHA as well.
@@ -173,7 +173,7 @@ static void oid_parsing(git_oid *oid)
*/
static void object_database(git_repository *repo, git_oid *oid)
{
- char oid_hex[GIT_OID_HEXSZ+1] = { 0 };
+ char oid_hex[GIT_OID_SHA1_HEXSIZE+1] = { 0 };
const unsigned char *data;
const char *str_type;
int error;
@@ -266,7 +266,7 @@ static void commit_writing(git_repository *repo)
git_tree *tree;
git_commit *parent;
git_signature *author, *committer;
- char oid_hex[GIT_OID_HEXSZ+1] = { 0 };
+ char oid_hex[GIT_OID_SHA1_HEXSIZE+1] = { 0 };
printf("\n*Commit Writing*\n");
@@ -287,9 +287,9 @@ static void commit_writing(git_repository *repo)
* parents. Here we're creating oid objects to create the commit with,
* but you can also use
*/
- git_oid_fromstr(&tree_id, "f60079018b664e4e79329a7ef9559c8d9e0378d1");
+ git_oid_fromstr(&tree_id, "f60079018b664e4e79329a7ef9559c8d9e0378d1", GIT_OID_SHA1);
git_tree_lookup(&tree, repo, &tree_id);
- git_oid_fromstr(&parent_id, "5b5b025afb0b4c913b4c338a42934a3863bf3644");
+ git_oid_fromstr(&parent_id, "5b5b025afb0b4c913b4c338a42934a3863bf3644", GIT_OID_SHA1);
git_commit_lookup(&parent, repo, &parent_id);
/**
@@ -345,7 +345,7 @@ static void commit_parsing(git_repository *repo)
const git_signature *author, *cmtter;
git_commit *commit, *parent;
git_oid oid;
- char oid_hex[GIT_OID_HEXSZ+1];
+ char oid_hex[GIT_OID_SHA1_HEXSIZE+1];
const char *message;
unsigned int parents, p;
int error;
@@ -353,7 +353,7 @@ static void commit_parsing(git_repository *repo)
printf("\n*Commit Parsing*\n");
- git_oid_fromstr(&oid, "8496071c1b46c854b31185ea97743be6a8774479");
+ git_oid_fromstr(&oid, "8496071c1b46c854b31185ea97743be6a8774479", GIT_OID_SHA1);
error = git_commit_lookup(&commit, repo, &oid);
check_error(error, "looking up commit");
@@ -422,7 +422,7 @@ static void tag_parsing(git_repository *repo)
* We create an oid for the tag object if we know the SHA and look it up
* the same way that we would a commit (or any other object).
*/
- git_oid_fromstr(&oid, "b25fa35b38051e4ae45d4222e795f9df2e43f1d1");
+ git_oid_fromstr(&oid, "b25fa35b38051e4ae45d4222e795f9df2e43f1d1", GIT_OID_SHA1);
error = git_tag_lookup(&tag, repo, &oid);
check_error(error, "looking up tag");
@@ -470,7 +470,7 @@ static void tree_parsing(git_repository *repo)
/**
* Create the oid and lookup the tree object just like the other objects.
*/
- git_oid_fromstr(&oid, "f60079018b664e4e79329a7ef9559c8d9e0378d1");
+ git_oid_fromstr(&oid, "f60079018b664e4e79329a7ef9559c8d9e0378d1", GIT_OID_SHA1);
git_tree_lookup(&tree, repo, &oid);
/**
@@ -524,7 +524,7 @@ static void blob_parsing(git_repository *repo)
printf("\n*Blob Parsing*\n");
- git_oid_fromstr(&oid, "1385f264afb75a56a5bec74243be9b367ba4ca08");
+ git_oid_fromstr(&oid, "1385f264afb75a56a5bec74243be9b367ba4ca08", GIT_OID_SHA1);
git_blob_lookup(&blob, repo, &oid);
/**
@@ -566,7 +566,7 @@ static void revwalking(git_repository *repo)
printf("\n*Revwalking*\n");
- git_oid_fromstr(&oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644");
+ git_oid_fromstr(&oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644", GIT_OID_SHA1);
/**
* To use the revwalker, create a new walker, tell it how you want to sort
@@ -679,7 +679,7 @@ static void reference_listing(git_repository *repo)
for (i = 0; i < ref_list.count; ++i) {
git_reference *ref;
- char oid_hex[GIT_OID_HEXSZ+1] = GIT_OID_HEX_ZERO;
+ char oid_hex[GIT_OID_SHA1_HEXSIZE+1] = GIT_OID_SHA1_HEXZERO;
const char *refname;
refname = ref_list.strings[i];