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.
Commit
8d9ea283732ef8c406abd31c20757ae01583a9e30032f6c5c756e1055074bc18
Parent
749d919ae9fbae4…
1 file changed
+19
+19
| --- src/url.c | ||
| +++ src/url.c | ||
| @@ -658,5 +658,24 @@ | ||
| 658 | 658 | if( zTail[i]==0 ) return 0; |
| 659 | 659 | for(i=0; zTail[i] && zTail[i]!='.' && zTail[i]!='?'; i++){} |
| 660 | 660 | if( i==0 ) return 0; |
| 661 | 661 | return mprintf("%.*s", i, zTail); |
| 662 | 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 | +} | |
| 663 | 682 |
| --- 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 |