Fossil SCM
Add a missing patch_resolve_remote() call in patch_toggle_ssh_needs_path(). Simplify patch_resolve_remote() a bit.
Commit
fe74b78eb1f14e40c6c56bec21039aaacd1219af8c8577e530b2beaccb1d0824
Parent
b380310558b9157…
1 file changed
+6
-11
+6
-11
| --- src/patch.c | ||
| +++ src/patch.c | ||
| @@ -703,24 +703,19 @@ | ||
| 703 | 703 | |
| 704 | 704 | /* |
| 705 | 705 | ** Resolves a patch-command remote system name, accounting for patch |
| 706 | 706 | ** aliases. |
| 707 | 707 | ** |
| 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, | |
| 709 | 709 | ** the corresponding value is returned, else a fossil_strdup() of zKey |
| 710 | 710 | ** is returned. |
| 711 | 711 | */ |
| 712 | 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); | |
| 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); | |
| 722 | 717 | } |
| 723 | 718 | |
| 724 | 719 | /* |
| 725 | 720 | ** Create a FILE* that will execute the remote side of a push or pull |
| 726 | 721 | ** using ssh (probably) or fossil for local pushes and pulls. Return |
| @@ -798,11 +793,11 @@ | ||
| 798 | 793 | /* |
| 799 | 794 | ** Toggle the use-path-for-ssh setting for the remote host defined |
| 800 | 795 | ** by g.argv[3]. |
| 801 | 796 | */ |
| 802 | 797 | 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]); | |
| 804 | 799 | char *zDir = (char*)file_skip_userhost(zRemote); |
| 805 | 800 | if( zDir ){ |
| 806 | 801 | *(char*)(zDir - 1) = 0; |
| 807 | 802 | ssh_needs_path_argument(zRemote, 99); |
| 808 | 803 | } |
| 809 | 804 |
| --- 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 |