I discovered that when we clone out a repository with ssh but the
URL has a port number in it gcli errors out by default when trying
to fetch anything.
This is because it puts the port number into the owner and the
resulting API endpoint is thus always incorrect.
Fix this by checking if anything after the first colon is a digit
and skip until we find a slash.
Signed-off-by: Nico Sonack <nsonack@herrhotzenplotz.de>
---
src/cmd/gitconfig.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/cmd/gitconfig.c b/src/cmd/gitconfig.c
index a24eb98..a03f373 100644
--- a/src/cmd/gitconfig.c+++ b/src/cmd/gitconfig.c
@@ -34,6 +34,7 @@
#include <gcli/gcli.h>
#include <sn/sn.h>
+#include <ctype.h>#include <dirent.h>
#include <signal.h>
#include <stdio.h>
@@ -332,6 +333,14 @@ ssh_extractor(struct gcli_gitremote *const remote, char const *prefix)
pair.data += 1;
pair.length -= 1;
+ /* sometimes we see port numbers in the SSH url */+ if (isdigit(*pair.data)) {+ sn_sv_chop_until(&pair, '/');++ pair.data += 1;+ pair.length -= 1;+ }+ remote->owner = sn_sv_chop_until(&pair, '/');
pair.data += 1;
--
2.45.2