Fossil SCM
Fix the "test-ssh-needs-path" command so that it works even if run from outside of an open check-out.
Commit
46e7855a4e19200ecde8772f0e988712467b1d29129776eb18221a3d0660a1c0
Parent
ed6495baa68341d…
1 file changed
+5
-2
+5
-2
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -312,27 +312,30 @@ | ||
| 312 | 312 | ** change the value. |
| 313 | 313 | ** |
| 314 | 314 | ** With no arguments, show all hosts for which ssh-needs-path is true. |
| 315 | 315 | */ |
| 316 | 316 | void test_ssh_needs_path(void){ |
| 317 | - db_find_and_open_repository(0,0); | |
| 317 | + db_find_and_open_repository(OPEN_OK_NOT_FOUND|OPEN_SUBSTITUTE,0); | |
| 318 | + db_open_config(0,0); | |
| 318 | 319 | if( g.argc>=3 ){ |
| 319 | 320 | const char *zHost = g.argv[2]; |
| 320 | 321 | int a = -1; |
| 321 | 322 | int rc; |
| 322 | 323 | if( g.argc>=4 ) a = is_truth(g.argv[3]); |
| 323 | 324 | rc = ssh_needs_path_argument(zHost, a); |
| 324 | 325 | fossil_print("%-20s %s\n", zHost, rc ? "yes" : "no"); |
| 325 | 326 | }else{ |
| 326 | 327 | Stmt s; |
| 327 | - db_prepare(&s, "SELECT substr(name,18) FROM config" | |
| 328 | + db_swap_connections(); | |
| 329 | + db_prepare(&s, "SELECT substr(name,18) FROM global_config" | |
| 328 | 330 | " WHERE name GLOB 'use-path-for-ssh:*'"); |
| 329 | 331 | while( db_step(&s)==SQLITE_ROW ){ |
| 330 | 332 | const char *zHost = db_column_text(&s,0); |
| 331 | 333 | fossil_print("%-20s yes\n", zHost); |
| 332 | 334 | } |
| 333 | 335 | db_finalize(&s); |
| 336 | + db_swap_connections(); | |
| 334 | 337 | } |
| 335 | 338 | } |
| 336 | 339 | |
| 337 | 340 | /* Add an approprate PATH= argument to the SSH command under construction |
| 338 | 341 | ** in pCmd. |
| 339 | 342 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -312,27 +312,30 @@ | |
| 312 | ** change the value. |
| 313 | ** |
| 314 | ** With no arguments, show all hosts for which ssh-needs-path is true. |
| 315 | */ |
| 316 | void test_ssh_needs_path(void){ |
| 317 | db_find_and_open_repository(0,0); |
| 318 | if( g.argc>=3 ){ |
| 319 | const char *zHost = g.argv[2]; |
| 320 | int a = -1; |
| 321 | int rc; |
| 322 | if( g.argc>=4 ) a = is_truth(g.argv[3]); |
| 323 | rc = ssh_needs_path_argument(zHost, a); |
| 324 | fossil_print("%-20s %s\n", zHost, rc ? "yes" : "no"); |
| 325 | }else{ |
| 326 | Stmt s; |
| 327 | db_prepare(&s, "SELECT substr(name,18) FROM config" |
| 328 | " WHERE name GLOB 'use-path-for-ssh:*'"); |
| 329 | while( db_step(&s)==SQLITE_ROW ){ |
| 330 | const char *zHost = db_column_text(&s,0); |
| 331 | fossil_print("%-20s yes\n", zHost); |
| 332 | } |
| 333 | db_finalize(&s); |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | /* Add an approprate PATH= argument to the SSH command under construction |
| 338 | ** in pCmd. |
| 339 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -312,27 +312,30 @@ | |
| 312 | ** change the value. |
| 313 | ** |
| 314 | ** With no arguments, show all hosts for which ssh-needs-path is true. |
| 315 | */ |
| 316 | void test_ssh_needs_path(void){ |
| 317 | db_find_and_open_repository(OPEN_OK_NOT_FOUND|OPEN_SUBSTITUTE,0); |
| 318 | db_open_config(0,0); |
| 319 | if( g.argc>=3 ){ |
| 320 | const char *zHost = g.argv[2]; |
| 321 | int a = -1; |
| 322 | int rc; |
| 323 | if( g.argc>=4 ) a = is_truth(g.argv[3]); |
| 324 | rc = ssh_needs_path_argument(zHost, a); |
| 325 | fossil_print("%-20s %s\n", zHost, rc ? "yes" : "no"); |
| 326 | }else{ |
| 327 | Stmt s; |
| 328 | db_swap_connections(); |
| 329 | db_prepare(&s, "SELECT substr(name,18) FROM global_config" |
| 330 | " WHERE name GLOB 'use-path-for-ssh:*'"); |
| 331 | while( db_step(&s)==SQLITE_ROW ){ |
| 332 | const char *zHost = db_column_text(&s,0); |
| 333 | fossil_print("%-20s yes\n", zHost); |
| 334 | } |
| 335 | db_finalize(&s); |
| 336 | db_swap_connections(); |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | /* Add an approprate PATH= argument to the SSH command under construction |
| 341 | ** in pCmd. |
| 342 |