Fossil SCM

Add the "test-url-basename" command for testing the url_to_repo_basename() function. Use this to try to reproduce the behavior reported on [forum:/forumpost/3e6f96bffc|forum post 3e6f96bffc], without success.

drh 2020-11-02 14:58 trunk
Commit 8d9ea283732ef8c406abd31c20757ae01583a9e30032f6c5c756e1055074bc18
1 file changed +19
+19
--- src/url.c
+++ src/url.c
@@ -658,5 +658,24 @@
658658
if( zTail[i]==0 ) return 0;
659659
for(i=0; zTail[i] && zTail[i]!='.' && zTail[i]!='?'; i++){}
660660
if( i==0 ) return 0;
661661
return mprintf("%.*s", i, zTail);
662662
}
663
+
664
+/*
665
+** COMMAND: test-url-basename
666
+** Usage: %fossil test-url-basenames URL ...
667
+**
668
+** This command is used for unit testing of the url_to_repo_basename()
669
+** routine. The command-line arguments are URL, presumably for remote
670
+** Fossil repositories. This command runs url_to_repo_basename() on each
671
+** of those inputs and displays the result.
672
+*/
673
+void cmd_test_url_basename(void){
674
+ int i;
675
+ char *z;
676
+ for(i=2; i<g.argc; i++){
677
+ z = url_to_repo_basename(g.argv[i]);
678
+ fossil_print("%s -> %s\n", g.argv[i], z);
679
+ fossil_free(z);
680
+ }
681
+}
663682
--- src/url.c
+++ src/url.c
@@ -658,5 +658,24 @@
658 if( zTail[i]==0 ) return 0;
659 for(i=0; zTail[i] && zTail[i]!='.' && zTail[i]!='?'; i++){}
660 if( i==0 ) return 0;
661 return mprintf("%.*s", i, zTail);
662 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
663
--- src/url.c
+++ src/url.c
@@ -658,5 +658,24 @@
658 if( zTail[i]==0 ) return 0;
659 for(i=0; zTail[i] && zTail[i]!='.' && zTail[i]!='?'; i++){}
660 if( i==0 ) return 0;
661 return mprintf("%.*s", i, zTail);
662 }
663
664 /*
665 ** COMMAND: test-url-basename
666 ** Usage: %fossil test-url-basenames URL ...
667 **
668 ** This command is used for unit testing of the url_to_repo_basename()
669 ** routine. The command-line arguments are URL, presumably for remote
670 ** Fossil repositories. This command runs url_to_repo_basename() on each
671 ** of those inputs and displays the result.
672 */
673 void cmd_test_url_basename(void){
674 int i;
675 char *z;
676 for(i=2; i<g.argc; i++){
677 z = url_to_repo_basename(g.argv[i]);
678 fossil_print("%s -> %s\n", g.argv[i], z);
679 fossil_free(z);
680 }
681 }
682

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button