diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2019-01-10 22:39:56 +0000 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2019-01-22 22:30:37 +0000 |
commit | fcc7dcb1762bbc01ef0088b4cc866ca712622e3a (patch) | |
tree | 8da31905b787a336433e8c262d54db7b7f391403 | |
parent | 115a6c50c9c67bdf952304a3ed6a24673b42b815 (diff) | |
download | libgit2-fcc7dcb1762bbc01ef0088b4cc866ca712622e3a.tar.gz |
errors: remove giterr usage in examples
-rw-r--r-- | examples/checkout.c | 10 | ||||
-rw-r--r-- | examples/common.c | 2 | ||||
-rw-r--r-- | examples/general.c | 2 | ||||
-rw-r--r-- | examples/merge.c | 4 | ||||
-rw-r--r-- | examples/network/clone.c | 2 | ||||
-rw-r--r-- | examples/network/git2.c | 4 |
6 files changed, 12 insertions, 12 deletions
diff --git a/examples/checkout.c b/examples/checkout.c index f92ad7399..9119d6503 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 4e0949b94..e20767a9e 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 7080cde4f..0b93a2e2f 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 761bd3a75..13e3f9632 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 ce4b6aedf..bbcd2e848 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 1d3d27b1b..d0d0eb610 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; |