Fossil SCM
Replace doc and arg validation pieces which were removed when [a6a679f11e3fd896] was split into a different branch but are still applicable.
Commit
da172e6ee3b1380f68d033c550a71472ddf63ab5297cbe7dc920f00ffa0400c0
Parent
e74de63bf707826…
1 file changed
+4
-3
+4
-3
| --- src/patch.c | ||
| +++ src/patch.c | ||
| @@ -705,11 +705,12 @@ | ||
| 705 | 705 | ** Resolves a patch-command remote system name, accounting for patch |
| 706 | 706 | ** aliases. |
| 707 | 707 | ** |
| 708 | 708 | ** If a CONFIG table entry matching name='patch-alias:$zKey' is found, |
| 709 | 709 | ** the corresponding value is returned, else a fossil_strdup() of zKey |
| 710 | -** is returned. | |
| 710 | +** is returned. The caller is responsible for passing the resulting | |
| 711 | +** string to fossil_free(). | |
| 711 | 712 | */ |
| 712 | 713 | static char *patch_resolve_remote(const char *zKey){ |
| 713 | 714 | char *zAlias = db_text(0, "SELECT value FROM config " |
| 714 | 715 | "WHERE name = 'patch-alias:%q'", |
| 715 | 716 | zKey); |
| @@ -1063,14 +1064,14 @@ | ||
| 1063 | 1064 | g.argv[4], g.argv[5]); |
| 1064 | 1065 | db_protect_pop(); |
| 1065 | 1066 | }else if( 0==strcmp("rm", zArg) ){ |
| 1066 | 1067 | /* alias rm */ |
| 1067 | 1068 | const int fAll = 0!=find_option("all", 0, 0); |
| 1068 | - verify_all_options(); | |
| 1069 | - if( g.argc<5 ){ | |
| 1069 | + if( fAll ? g.argc<4 : g.argc<5 ){ | |
| 1070 | 1070 | usage("alias rm [-all] [aliasGlob [...aliasGlobN]]"); |
| 1071 | 1071 | } |
| 1072 | + verify_all_options(); | |
| 1072 | 1073 | db_unprotect(PROTECT_CONFIG); |
| 1073 | 1074 | if( 0!=fAll ){ |
| 1074 | 1075 | db_multi_exec("DELETE FROM config WHERE name GLOB 'patch-alias:*'"); |
| 1075 | 1076 | }else{ |
| 1076 | 1077 | Stmt q; |
| 1077 | 1078 |
| --- src/patch.c | |
| +++ src/patch.c | |
| @@ -705,11 +705,12 @@ | |
| 705 | ** Resolves a patch-command remote system name, accounting for patch |
| 706 | ** aliases. |
| 707 | ** |
| 708 | ** If a CONFIG table entry matching name='patch-alias:$zKey' is found, |
| 709 | ** the corresponding value is returned, else a fossil_strdup() of zKey |
| 710 | ** is returned. |
| 711 | */ |
| 712 | static char *patch_resolve_remote(const char *zKey){ |
| 713 | char *zAlias = db_text(0, "SELECT value FROM config " |
| 714 | "WHERE name = 'patch-alias:%q'", |
| 715 | zKey); |
| @@ -1063,14 +1064,14 @@ | |
| 1063 | g.argv[4], g.argv[5]); |
| 1064 | db_protect_pop(); |
| 1065 | }else if( 0==strcmp("rm", zArg) ){ |
| 1066 | /* alias rm */ |
| 1067 | const int fAll = 0!=find_option("all", 0, 0); |
| 1068 | verify_all_options(); |
| 1069 | if( g.argc<5 ){ |
| 1070 | usage("alias rm [-all] [aliasGlob [...aliasGlobN]]"); |
| 1071 | } |
| 1072 | db_unprotect(PROTECT_CONFIG); |
| 1073 | if( 0!=fAll ){ |
| 1074 | db_multi_exec("DELETE FROM config WHERE name GLOB 'patch-alias:*'"); |
| 1075 | }else{ |
| 1076 | Stmt q; |
| 1077 |
| --- src/patch.c | |
| +++ src/patch.c | |
| @@ -705,11 +705,12 @@ | |
| 705 | ** Resolves a patch-command remote system name, accounting for patch |
| 706 | ** aliases. |
| 707 | ** |
| 708 | ** If a CONFIG table entry matching name='patch-alias:$zKey' is found, |
| 709 | ** the corresponding value is returned, else a fossil_strdup() of zKey |
| 710 | ** is returned. The caller is responsible for passing the resulting |
| 711 | ** string to fossil_free(). |
| 712 | */ |
| 713 | static char *patch_resolve_remote(const char *zKey){ |
| 714 | char *zAlias = db_text(0, "SELECT value FROM config " |
| 715 | "WHERE name = 'patch-alias:%q'", |
| 716 | zKey); |
| @@ -1063,14 +1064,14 @@ | |
| 1064 | g.argv[4], g.argv[5]); |
| 1065 | db_protect_pop(); |
| 1066 | }else if( 0==strcmp("rm", zArg) ){ |
| 1067 | /* alias rm */ |
| 1068 | const int fAll = 0!=find_option("all", 0, 0); |
| 1069 | if( fAll ? g.argc<4 : g.argc<5 ){ |
| 1070 | usage("alias rm [-all] [aliasGlob [...aliasGlobN]]"); |
| 1071 | } |
| 1072 | verify_all_options(); |
| 1073 | db_unprotect(PROTECT_CONFIG); |
| 1074 | if( 0!=fAll ){ |
| 1075 | db_multi_exec("DELETE FROM config WHERE name GLOB 'patch-alias:*'"); |
| 1076 | }else{ |
| 1077 | Stmt q; |
| 1078 |