summaryrefslogtreecommitdiff
path: root/examples/remote.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-04-23 06:01:13 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-05-13 09:46:36 +0200
commit3fec548a989b09fc7a2c30f42b1d4fa123a8867e (patch)
treec70e12e3aa0f678c5fcc9ead6a46669dec24d90f /examples/remote.c
parent35a8a8c546fe3d0a5bc7df7cf418244133ccf238 (diff)
downloadlibgit2-3fec548a989b09fc7a2c30f42b1d4fa123a8867e.tar.gz
examples: adjust to the new remote API
Diffstat (limited to 'examples/remote.c')
-rw-r--r--examples/remote.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/examples/remote.c b/examples/remote.c
index b756b5642..e0d5a1406 100644
--- a/examples/remote.c
+++ b/examples/remote.c
@@ -151,7 +151,6 @@ static int cmd_seturl(git_repository *repo, struct opts *o)
{
int i, retval, push = 0;
char *name = NULL, *url = NULL;
- git_remote *remote;
for (i = 0; i < o->argc; i++) {
char *arg = o->argv[i];
@@ -170,19 +169,12 @@ static int cmd_seturl(git_repository *repo, struct opts *o)
if (name == NULL || url == NULL)
usage("you need to specify remote and the new URL", NULL);
- check_lg2(git_remote_lookup(&remote, repo, name),
- "could not look up remote", name);
-
if (push)
- retval = git_remote_set_pushurl(remote, url);
+ retval = git_remote_set_pushurl(repo, name, url);
else
- retval = git_remote_set_url(remote, url);
- check_lg2(retval, "could not set URL", url);
+ retval = git_remote_set_url(repo, name, url);
- check_lg2(git_remote_save(remote),
- "could not save remote", NULL);
-
- git_remote_free(remote);
+ check_lg2(retval, "could not set URL", url);
return 0;
}