Fossil User Forum

"fossil git status" reports "unknown repository" when using SSH
Login

"fossil git status" reports "unknown repository" when using SSH

"fossil git status" reports "unknown repository" when using SSH

(1) By bohwaz on 2024-03-28 20:25:35 [source]

If I use SSH to sync my git repo, then "fossil git status" will report this error:

unknown repository: git@example.org:org/project.git

I think things are working correctly and this is just a bug in parsing the URL.

Here is a quick patch:

Index: src/export.c
==================================================================
--- src/export.c
+++ src/export.c
@@ -1787,12 +1787,16 @@
   z = db_text(0, "SELECT value FROM mconfig WHERE key='autopush'");
   if( z==0 ){
     fossil_print("Autopush:    off\n");
   }else{
     UrlData url;
-    url_parse_local(z, 0, &url);
-    fossil_print("Autopush:    %s\n", url.canonical);
+    if( sqlite3_strglob("http*", url)==0 ){
+      url_parse_local(z, 0, &url);
+      fossil_print("Autopush:    %s\n", url.canonical);
+    }else{
+      fossil_print("Autopush:    %s\n", url);
+    }
     fossil_free(z);
   }
   n = db_int(0,
     "SELECT count(*) FROM event"
     " WHERE type='ci'"

(2) By Richard Hipp (drh) on 2024-03-28 20:49:18 in reply to 1 [link] [source]

That doesn't look right to me. The first sqlite3_strglob() call references an uninitialized variable, url.

(3) By Richard Hipp (drh) on 2024-03-28 20:56:07 in reply to 2 [link] [source]

Maybe that url variable is suppose to be z instead...

(4) By bohwaz on 2024-03-28 21:52:45 in reply to 3 [link] [source]

Yes sorry, I just copy-pasted the code from the previous function without testing :)

Here it's fixed:

Index: src/export.c
==================================================================
--- src/export.c
+++ src/export.c
@@ -1787,12 +1787,16 @@
   z = db_text(0, "SELECT value FROM mconfig WHERE key='autopush'");
   if( z==0 ){
     fossil_print("Autopush:    off\n");
   }else{
     UrlData url;
-    url_parse_local(z, 0, &url);
-    fossil_print("Autopush:    %s\n", url.canonical);
+    if( sqlite3_strglob("http*", z)==0 ){
+      url_parse_local(z, 0, &url);
+      fossil_print("Autopush:    %s\n", url.canonical);
+    }else{
+      fossil_print("Autopush:    %s\n", url);
+    }
     fossil_free(z);
   }
   n = db_int(0,
     "SELECT count(*) FROM event"
     " WHERE type='ci'"

(5) By bohwaz on 2024-04-06 19:11:14 in reply to 4 [link] [source]

Thank you for implementing the patch; have a nice day :)