diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2022-01-22 23:10:03 -0500 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2022-06-14 22:29:57 -0400 |
commit | dbc4ac1c76827e954e0aa27afe8bb7e0b8993a93 (patch) | |
tree | 56f18a11bca8d17490a176cddf9e3756c2cebe91 /examples | |
parent | f98dd5438f8d7bfd557b612fdf1605b1c3fb8eaf (diff) | |
download | libgit2-dbc4ac1c76827e954e0aa27afe8bb7e0b8993a93.tar.gz |
oid: `GIT_OID_*SZ` is now `GIT_OID_SHA1_*SIZE`
In preparation for SHA256 support, `GIT_OID_RAWSZ` and `GIT_OID_HEXSZ`
need to indicate that they're the size of _SHA1_ OIDs.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/cat-file.c | 10 | ||||
-rw-r--r-- | examples/fetch.c | 6 | ||||
-rw-r--r-- | examples/for-each-ref.c | 4 | ||||
-rw-r--r-- | examples/general.c | 12 | ||||
-rw-r--r-- | examples/log.c | 2 | ||||
-rw-r--r-- | examples/ls-remote.c | 2 | ||||
-rw-r--r-- | examples/rev-list.c | 4 | ||||
-rw-r--r-- | examples/rev-parse.c | 2 | ||||
-rw-r--r-- | examples/show-index.c | 4 |
9 files changed, 23 insertions, 23 deletions
diff --git a/examples/cat-file.c b/examples/cat-file.c index b81e9a8da..741edb484 100644 --- a/examples/cat-file.c +++ b/examples/cat-file.c @@ -49,7 +49,7 @@ static void show_blob(const git_blob *blob) static void show_tree(const git_tree *tree) { size_t i, max_i = (int)git_tree_entrycount(tree); - char oidstr[GIT_OID_HEXSZ + 1]; + char oidstr[GIT_OID_SHA1_HEXSIZE + 1]; const git_tree_entry *te; for (i = 0; i < max_i; ++i) { @@ -70,7 +70,7 @@ static void show_tree(const git_tree *tree) static void show_commit(const git_commit *commit) { unsigned int i, max_i; - char oidstr[GIT_OID_HEXSZ + 1]; + char oidstr[GIT_OID_SHA1_HEXSIZE + 1]; git_oid_tostr(oidstr, sizeof(oidstr), git_commit_tree_id(commit)); printf("tree %s\n", oidstr); @@ -90,7 +90,7 @@ static void show_commit(const git_commit *commit) static void show_tag(const git_tag *tag) { - char oidstr[GIT_OID_HEXSZ + 1]; + char oidstr[GIT_OID_SHA1_HEXSIZE + 1]; git_oid_tostr(oidstr, sizeof(oidstr), git_tag_target_id(tag));; printf("object %s\n", oidstr); @@ -125,7 +125,7 @@ int lg2_cat_file(git_repository *repo, int argc, char *argv[]) { struct catfile_options o = { ".", NULL, 0, 0 }; git_object *obj = NULL; - char oidstr[GIT_OID_HEXSZ + 1]; + char oidstr[GIT_OID_SHA1_HEXSIZE + 1]; parse_opts(&o, argc, argv); @@ -133,7 +133,7 @@ int lg2_cat_file(git_repository *repo, int argc, char *argv[]) "Could not resolve", o.rev); if (o.verbose) { - char oidstr[GIT_OID_HEXSZ + 1]; + char oidstr[GIT_OID_SHA1_HEXSIZE + 1]; git_oid_tostr(oidstr, sizeof(oidstr), git_object_id(obj)); printf("%s %s\n--\n", diff --git a/examples/fetch.c b/examples/fetch.c index 2b5ed1112..bbd882cfb 100644 --- a/examples/fetch.c +++ b/examples/fetch.c @@ -15,17 +15,17 @@ static int progress_cb(const char *str, int len, void *data) */ static int update_cb(const char *refname, const git_oid *a, const git_oid *b, void *data) { - char a_str[GIT_OID_HEXSZ+1], b_str[GIT_OID_HEXSZ+1]; + char a_str[GIT_OID_SHA1_HEXSIZE+1], b_str[GIT_OID_SHA1_HEXSIZE+1]; (void)data; git_oid_fmt(b_str, b); - b_str[GIT_OID_HEXSZ] = '\0'; + b_str[GIT_OID_SHA1_HEXSIZE] = '\0'; if (git_oid_is_zero(a)) { printf("[new] %.20s %s\n", b_str, refname); } else { git_oid_fmt(a_str, a); - a_str[GIT_OID_HEXSZ] = '\0'; + a_str[GIT_OID_SHA1_HEXSIZE] = '\0'; printf("[updated] %.10s..%.10s %s\n", a_str, b_str, refname); } diff --git a/examples/for-each-ref.c b/examples/for-each-ref.c index 020dab474..a0706741a 100644 --- a/examples/for-each-ref.c +++ b/examples/for-each-ref.c @@ -5,7 +5,7 @@ static int show_ref(git_reference *ref, void *data) { git_repository *repo = data; git_reference *resolved = NULL; - char hex[GIT_OID_HEXSZ+1]; + char hex[GIT_OID_SHA1_HEXSIZE+1]; const git_oid *oid; git_object *obj; @@ -16,7 +16,7 @@ static int show_ref(git_reference *ref, void *data) oid = git_reference_target(resolved ? resolved : ref); git_oid_fmt(hex, oid); - hex[GIT_OID_HEXSZ] = 0; + hex[GIT_OID_SHA1_HEXSIZE] = 0; check_lg2(git_object_lookup(&obj, repo, oid, GIT_OBJECT_ANY), "Unable to lookup object", hex); diff --git a/examples/general.c b/examples/general.c index 2127ec0e1..9e678f887 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"); @@ -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"); @@ -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; @@ -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_HEX_ZERO; const char *refname; refname = ref_list.strings[i]; diff --git a/examples/log.c b/examples/log.c index 9060f3f3e..4b0a95dcd 100644 --- a/examples/log.c +++ b/examples/log.c @@ -329,7 +329,7 @@ static void print_time(const git_time *intime, const char *prefix) /** Helper to print a commit object. */ static void print_commit(git_commit *commit, struct log_options *opts) { - char buf[GIT_OID_HEXSZ + 1]; + char buf[GIT_OID_SHA1_HEXSIZE + 1]; int i, count; const git_signature *sig; const char *scan, *eol; diff --git a/examples/ls-remote.c b/examples/ls-remote.c index 03ed887d1..24caae712 100644 --- a/examples/ls-remote.c +++ b/examples/ls-remote.c @@ -34,7 +34,7 @@ static int use_remote(git_repository *repo, char *name) goto cleanup; for (i = 0; i < refs_len; i++) { - char oid[GIT_OID_HEXSZ + 1] = {0}; + char oid[GIT_OID_SHA1_HEXSIZE + 1] = {0}; git_oid_fmt(oid, &refs[i]->oid); printf("%s\t%s\n", oid, refs[i]->name); } diff --git a/examples/rev-list.c b/examples/rev-list.c index d10f16690..0ca40a20e 100644 --- a/examples/rev-list.c +++ b/examples/rev-list.c @@ -26,7 +26,7 @@ int lg2_rev_list(git_repository *repo, int argc, char **argv) git_revwalk *walk; git_oid oid; git_sort_t sort; - char buf[GIT_OID_HEXSZ+1]; + char buf[GIT_OID_SHA1_HEXSIZE+1]; check_lg2(revwalk_parse_options(&sort, &args), "parsing options", NULL); @@ -36,7 +36,7 @@ int lg2_rev_list(git_repository *repo, int argc, char **argv) while (!git_revwalk_next(&oid, walk)) { git_oid_fmt(buf, &oid); - buf[GIT_OID_HEXSZ] = '\0'; + buf[GIT_OID_SHA1_HEXSIZE] = '\0'; printf("%s\n", buf); } diff --git a/examples/rev-parse.c b/examples/rev-parse.c index 90258c101..3f68d79b7 100644 --- a/examples/rev-parse.c +++ b/examples/rev-parse.c @@ -65,7 +65,7 @@ static void parse_opts(struct parse_state *ps, int argc, char *argv[]) static int parse_revision(git_repository *repo, struct parse_state *ps) { git_revspec rs; - char str[GIT_OID_HEXSZ + 1]; + char str[GIT_OID_SHA1_HEXSIZE + 1]; check_lg2(git_revparse(&rs, repo, ps->spec), "Could not parse", ps->spec); diff --git a/examples/show-index.c b/examples/show-index.c index 7aaa45e65..fb797e04b 100644 --- a/examples/show-index.c +++ b/examples/show-index.c @@ -20,8 +20,8 @@ int lg2_show_index(git_repository *repo, int argc, char **argv) size_t i, ecount; char *dir = "."; size_t dirlen; - char out[GIT_OID_HEXSZ+1]; - out[GIT_OID_HEXSZ] = '\0'; + char out[GIT_OID_SHA1_HEXSIZE+1]; + out[GIT_OID_SHA1_HEXSIZE] = '\0'; if (argc > 2) fatal("usage: showindex [<repo-dir>]", NULL); |