Fossil SCM

Replace doc and arg validation pieces which were removed when [a6a679f11e3fd896] was split into a different branch but are still applicable.

stephan 2025-02-28 21:26 patch-alias
Commit da172e6ee3b1380f68d033c550a71472ddf63ab5297cbe7dc920f00ffa0400c0
1 file changed +4 -3
+4 -3
--- src/patch.c
+++ src/patch.c
@@ -705,11 +705,12 @@
705705
** Resolves a patch-command remote system name, accounting for patch
706706
** aliases.
707707
**
708708
** If a CONFIG table entry matching name='patch-alias:$zKey' is found,
709709
** 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().
711712
*/
712713
static char *patch_resolve_remote(const char *zKey){
713714
char *zAlias = db_text(0, "SELECT value FROM config "
714715
"WHERE name = 'patch-alias:%q'",
715716
zKey);
@@ -1063,14 +1064,14 @@
10631064
g.argv[4], g.argv[5]);
10641065
db_protect_pop();
10651066
}else if( 0==strcmp("rm", zArg) ){
10661067
/* alias rm */
10671068
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 ){
10701070
usage("alias rm [-all] [aliasGlob [...aliasGlobN]]");
10711071
}
1072
+ verify_all_options();
10721073
db_unprotect(PROTECT_CONFIG);
10731074
if( 0!=fAll ){
10741075
db_multi_exec("DELETE FROM config WHERE name GLOB 'patch-alias:*'");
10751076
}else{
10761077
Stmt q;
10771078
--- 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

Keyboard Shortcuts

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