summaryrefslogtreecommitdiff
path: root/src/remote.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-05-05 09:21:58 +0200
committerPatrick Steinhardt <ps@pks.im>2017-05-05 10:40:21 +0200
commitfd2ff8c97d26ac747a40766242d10c9f3c8a9564 (patch)
treef9ea79811af31f77cd433335c841770e0f048865 /src/remote.c
parent1b6ab16fa5ab1b3f827045a3a9181519281f9892 (diff)
downloadlibgit2-fd2ff8c97d26ac747a40766242d10c9f3c8a9564.tar.gz
remote: improve error message if no URL is set
The current error message when connecting to a remote when no URL is set is missing information on whether it is missing a fetch or push URL. Furthermore, it results in undefined behavior when using a remote without name. Fix both issues.
Diffstat (limited to 'src/remote.c')
-rw-r--r--src/remote.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/remote.c b/src/remote.c
index bd8b3cfbc..bbca7aea9 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -674,7 +674,9 @@ int git_remote_connect(git_remote *remote, git_direction direction, const git_re
url = git_remote__urlfordirection(remote, direction);
if (url == NULL) {
giterr_set(GITERR_INVALID,
- "Malformed remote '%s' - missing URL", remote->name);
+ "Malformed remote '%s' - missing %s URL",
+ remote->name ? remote->name : "(anonymous)",
+ direction == GIT_DIRECTION_FETCH ? "fetch" : "push");
return -1;
}