errors: remove giterr usage in examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
diff --git a/examples/checkout.c b/examples/checkout.c
index f92ad73..9119d65 100644
--- a/examples/checkout.c
+++ b/examples/checkout.c
@@ -132,7 +132,7 @@ static int perform_checkout_ref(git_repository *repo, git_annotated_commit *targ
/** Grab the commit we're interested to move to */
err = git_commit_lookup(&target_commit, repo, git_annotated_commit_id(target));
if (err != 0) {
- fprintf(stderr, "failed to lookup commit: %s\n", giterr_last()->message);
+ fprintf(stderr, "failed to lookup commit: %s\n", git_error_last()->message);
goto cleanup;
}
@@ -140,12 +140,12 @@ static int perform_checkout_ref(git_repository *repo, git_annotated_commit *targ
* Perform the checkout so the workdir corresponds to what target_commit
* contains.
*
- * Note that it's okay to pass a git_commit here, because it will be
+ * Note that it's okay to pass a git_commit here, because it will be
* peeled to a tree.
*/
err = git_checkout_tree(repo, (const git_object *)target_commit, &checkout_opts);
if (err != 0) {
- fprintf(stderr, "failed to checkout tree: %s\n", giterr_last()->message);
+ fprintf(stderr, "failed to checkout tree: %s\n", git_error_last()->message);
goto cleanup;
}
@@ -161,7 +161,7 @@ static int perform_checkout_ref(git_repository *repo, git_annotated_commit *targ
err = git_repository_set_head_detached_from_annotated(repo, target);
}
if (err != 0) {
- fprintf(stderr, "failed to update HEAD reference: %s\n", giterr_last()->message);
+ fprintf(stderr, "failed to update HEAD reference: %s\n", git_error_last()->message);
goto cleanup;
}
@@ -219,7 +219,7 @@ int main(int argc, char **argv)
*/
err = resolve_refish(&checkout_target, repo, args.argv[args.pos]);
if (err != 0) {
- fprintf(stderr, "failed to resolve %s: %s\n", args.argv[args.pos], giterr_last()->message);
+ fprintf(stderr, "failed to resolve %s: %s\n", args.argv[args.pos], git_error_last()->message);
goto cleanup;
}
err = perform_checkout_ref(repo, checkout_target, &opts);
diff --git a/examples/common.c b/examples/common.c
index 4e0949b..e20767a 100644
--- a/examples/common.c
+++ b/examples/common.c
@@ -24,7 +24,7 @@ void check_lg2(int error, const char *message, const char *extra)
if (!error)
return;
- if ((lg2err = giterr_last()) != NULL && lg2err->message != NULL) {
+ if ((lg2err = git_error_last()) != NULL && lg2err->message != NULL) {
lg2msg = lg2err->message;
lg2spacer = " - ";
}
diff --git a/examples/general.c b/examples/general.c
index 7080cde..0b93a2e 100644
--- a/examples/general.c
+++ b/examples/general.c
@@ -66,7 +66,7 @@ static void config_files(const char *repo_path, git_repository *repo);
*/
static void check_error(int error_code, const char *action)
{
- const git_error *error = giterr_last();
+ const git_error *error = git_error_last();
if (!error_code)
return;
diff --git a/examples/merge.c b/examples/merge.c
index 761bd3a..13e3f96 100644
--- a/examples/merge.c
+++ b/examples/merge.c
@@ -96,7 +96,7 @@ static int resolve_heads(git_repository *repo, merge_options *opts)
for (i = 0; i < opts->heads_count; i++) {
err = resolve_refish(&annotated[annotated_count++], repo, opts->heads[i]);
if (err != 0) {
- fprintf(stderr, "failed to resolve refish %s: %s\n", opts->heads[i], giterr_last()->message);
+ fprintf(stderr, "failed to resolve refish %s: %s\n", opts->heads[i], git_error_last()->message);
annotated_count--;
continue;
}
@@ -229,7 +229,7 @@ static int create_merge_commit(git_repository *repo, git_index *index, merge_opt
/* Maybe that's a ref, so DWIM it */
err = git_reference_dwim(&merge_ref, repo, opts->heads[0]);
- check_lg2(err, "failed to DWIM reference", giterr_last()->message);
+ check_lg2(err, "failed to DWIM reference", git_error_last()->message);
/* Grab a signature */
check_lg2(git_signature_now(&sign, "Me", "me@example.com"), "failed to create signature", NULL);
diff --git a/examples/network/clone.c b/examples/network/clone.c
index ce4b6ae..bbcd2e8 100644
--- a/examples/network/clone.c
+++ b/examples/network/clone.c
@@ -104,7 +104,7 @@ int do_clone(git_repository *repo, int argc, char **argv)
error = git_clone(&cloned_repo, url, path, &clone_opts);
printf("\n");
if (error != 0) {
- const git_error *err = giterr_last();
+ const git_error *err = git_error_last();
if (err) printf("ERROR %d: %s\n", err->klass, err->message);
else printf("ERROR %d: no detailed info\n", error);
}
diff --git a/examples/network/git2.c b/examples/network/git2.c
index 1d3d27b..d0d0eb6 100644
--- a/examples/network/git2.c
+++ b/examples/network/git2.c
@@ -26,10 +26,10 @@ static int run_command(git_cb fn, git_repository *repo, struct args_info args)
/* Run the command. If something goes wrong, print the error message to stderr */
error = fn(repo, args.argc - args.pos, &args.argv[args.pos]);
if (error < 0) {
- if (giterr_last() == NULL)
+ if (git_error_last() == NULL)
fprintf(stderr, "Error without message");
else
- fprintf(stderr, "Bad news:\n %s\n", giterr_last()->message);
+ fprintf(stderr, "Bad news:\n %s\n", git_error_last()->message);
}
return !!error;