remote example: fix problem.strings[] indexing

This commit is contained in:
Łukasz Langa
2025-10-21 16:07:02 +02:00
parent bc5a7e930a
commit 54d142d986

View File

@@ -80,7 +80,7 @@ int lg2_remote(git_repository *repo, int argc, char *argv[])
static int cmd_add(git_repository *repo, struct remote_opts *o) static int cmd_add(git_repository *repo, struct remote_opts *o)
{ {
char *name, *url; char *name, *url;
git_remote *remote = {0}; git_remote *remote = NULL;
if (o->argc != 2) if (o->argc != 2)
usage("you need to specify a name and URL", NULL); usage("you need to specify a name and URL", NULL);
@@ -126,7 +126,7 @@ static int cmd_rename(git_repository *repo, struct remote_opts *o)
return 0; return 0;
for (i = 0; i < (int) problems.count; i++) { for (i = 0; i < (int) problems.count; i++) {
puts(problems.strings[0]); puts(problems.strings[i]);
} }
git_strarray_dispose(&problems); git_strarray_dispose(&problems);
@@ -172,7 +172,7 @@ static int cmd_show(git_repository *repo, struct remote_opts *o)
const char *arg, *name, *fetch, *push; const char *arg, *name, *fetch, *push;
int verbose = 0; int verbose = 0;
git_strarray remotes = {0}; git_strarray remotes = {0};
git_remote *remote = {0}; git_remote *remote = NULL;
for (i = 0; i < o->argc; i++) { for (i = 0; i < o->argc; i++) {
arg = o->argv[i]; arg = o->argv[i];