Fossil SCM

Add a missing patch_resolve_remote() call in patch_toggle_ssh_needs_path(). Simplify patch_resolve_remote() a bit.

stephan 2025-02-27 22:38 patch-alias
Commit fe74b78eb1f14e40c6c56bec21039aaacd1219af8c8577e530b2beaccb1d0824
1 file changed +6 -11
+6 -11
--- src/patch.c
+++ src/patch.c
@@ -703,24 +703,19 @@
703703
704704
/*
705705
** Resolves a patch-command remote system name, accounting for patch
706706
** aliases.
707707
**
708
-** If a CONFIG table entry matching name='patch-alias:zKey' is found,
708
+** If a CONFIG table entry matching name='patch-alias:$zKey' is found,
709709
** the corresponding value is returned, else a fossil_strdup() of zKey
710710
** is returned.
711711
*/
712712
static char * patch_resolve_remote(const char *zKey){
713
- char * zAlias;
714
-
715
- zAlias = db_text(0, "SELECT value FROM config "
716
- "WHERE name = 'patch-alias:' || %Q",
717
- zKey);
718
- if( 0!=zAlias ){
719
- return zAlias;
720
- }
721
- return fossil_strdup(zKey);
713
+ char * zAlias = db_text(0, "SELECT value FROM config "
714
+ "WHERE name = 'patch-alias:' || %Q",
715
+ zKey);
716
+ return zAlias ? zAlias : fossil_strdup(zKey);
722717
}
723718
724719
/*
725720
** Create a FILE* that will execute the remote side of a push or pull
726721
** using ssh (probably) or fossil for local pushes and pulls. Return
@@ -798,11 +793,11 @@
798793
/*
799794
** Toggle the use-path-for-ssh setting for the remote host defined
800795
** by g.argv[3].
801796
*/
802797
static void patch_toggle_ssh_needs_path(void){
803
- char *zRemote = fossil_strdup(g.argv[3]);
798
+ char *zRemote = patch_resolve_remote(g.argv[3]);
804799
char *zDir = (char*)file_skip_userhost(zRemote);
805800
if( zDir ){
806801
*(char*)(zDir - 1) = 0;
807802
ssh_needs_path_argument(zRemote, 99);
808803
}
809804
--- src/patch.c
+++ src/patch.c
@@ -703,24 +703,19 @@
703
704 /*
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;
714
715 zAlias = db_text(0, "SELECT value FROM config "
716 "WHERE name = 'patch-alias:' || %Q",
717 zKey);
718 if( 0!=zAlias ){
719 return zAlias;
720 }
721 return fossil_strdup(zKey);
722 }
723
724 /*
725 ** Create a FILE* that will execute the remote side of a push or pull
726 ** using ssh (probably) or fossil for local pushes and pulls. Return
@@ -798,11 +793,11 @@
798 /*
799 ** Toggle the use-path-for-ssh setting for the remote host defined
800 ** by g.argv[3].
801 */
802 static void patch_toggle_ssh_needs_path(void){
803 char *zRemote = fossil_strdup(g.argv[3]);
804 char *zDir = (char*)file_skip_userhost(zRemote);
805 if( zDir ){
806 *(char*)(zDir - 1) = 0;
807 ssh_needs_path_argument(zRemote, 99);
808 }
809
--- src/patch.c
+++ src/patch.c
@@ -703,24 +703,19 @@
703
704 /*
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);
716 return zAlias ? zAlias : fossil_strdup(zKey);
 
 
 
 
 
717 }
718
719 /*
720 ** Create a FILE* that will execute the remote side of a push or pull
721 ** using ssh (probably) or fossil for local pushes and pulls. Return
@@ -798,11 +793,11 @@
793 /*
794 ** Toggle the use-path-for-ssh setting for the remote host defined
795 ** by g.argv[3].
796 */
797 static void patch_toggle_ssh_needs_path(void){
798 char *zRemote = patch_resolve_remote(g.argv[3]);
799 char *zDir = (char*)file_skip_userhost(zRemote);
800 if( zDir ){
801 *(char*)(zDir - 1) = 0;
802 ssh_needs_path_argument(zRemote, 99);
803 }
804

Keyboard Shortcuts

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