Fossil SCM

The "ssh:"-style requests are eating the query parameters, somewhere. I don't know where yet. Don't use query parameter for the time being.

drh 2025-10-15 20:12 get-command
Commit 8028c868d3c0551d4b3ba766e354b22d12bd64aba38f045cc701a0c93078f55a
2 files changed +22 -2 +8 -6
+22 -2
--- src/checkout.c
+++ src/checkout.c
@@ -466,11 +466,13 @@
466466
** -v|--verbose Show all files as they are extracted
467467
*/
468468
void get_cmd(void){
469469
int forceFlag = find_option("force","f",0)!=0;
470470
int bVerbose = find_option("verbose","v",0)!=0;
471
+ int bQuiet = find_option("quiet","q",0)!=0;
471472
int bDebug = find_option("debug",0,0)!=0;
473
+ int bList = find_option("list",0,0)!=0;
472474
const char *zSqlArchive = find_option("sqlar",0,1);
473475
const char *z;
474476
char *zDest = 0; /* Where to store results */
475477
const char *zUrl; /* Url to get */
476478
const char *zVers; /* Version name to get */
@@ -478,10 +480,13 @@
478480
Blob in, out; /* I/O for the HTTP request */
479481
Blob file; /* A file to extract */
480482
sqlite3 *db; /* Database containing downloaded sqlar */
481483
sqlite3_stmt *pStmt; /* Statement for querying the database */
482484
int rc; /* Result of subroutine calls */
485
+ int nFile = 0; /* Number of files written */
486
+ int nDir = 0; /* Number of directories written */
487
+ i64 nByte = 0; /* Number of bytes written */
483488
484489
z = find_option("dest",0,1);
485490
if( z ) zDest = fossil_strdup(z);
486491
verify_all_options();
487492
if( g.argc<3 || g.argc>4 ){
@@ -536,11 +541,11 @@
536541
}
537542
}
538543
539544
/* Construct a subpath on the URL if necessary */
540545
if( g.url.isSsh || g.url.isFile ){
541
- g.url.subpath = mprintf("/sqlar?name=%t&r=%t", zDest, zVers);
546
+ g.url.subpath = mprintf("/sqlar/%t/%t.sqlar", zVers, zDest);
542547
}
543548
544549
if( bDebug ){
545550
urlparse_print(0);
546551
}
@@ -547,10 +552,11 @@
547552
548553
/* Fetch the ZIP archive for the requested check-in */
549554
blob_init(&in, 0, 0);
550555
blob_init(&out, 0, 0);
551556
if( bDebug ) mHttpFlags |= HTTP_VERBOSE;
557
+ if( bQuiet ) mHttpFlags |= HTTP_QUIET;
552558
http_exchange(&in, &out, mHttpFlags, 4, 0);
553559
554560
if( zSqlArchive ){
555561
blob_write_to_file(&out, zSqlArchive);
556562
if( bVerbose ) fossil_print("%s\n", zSqlArchive);
@@ -576,18 +582,23 @@
576582
blob_init(&file, 0, 0);
577583
while( sqlite3_step(pStmt)==SQLITE_ROW ){
578584
const char *zFilename = (const char*)sqlite3_column_text(pStmt, 0);
579585
int mode = sqlite3_column_int(pStmt, 1);
580586
int sz = sqlite3_column_int(pStmt, 2);
581
- if( mode & 0x4000 ){
587
+ if( bList ){
588
+ fossil_print("%s\n", zFilename);
589
+ }else if( mode & 0x4000 ){
582590
/* A directory name */
591
+ nDir++;
583592
file_mkdir(zFilename, ExtFILE, 1);
584593
}else{
585594
/* A file */
586595
unsigned char *inBuf = (unsigned char*)sqlite3_column_blob(pStmt,3);
587596
unsigned int nIn = (unsigned int)sqlite3_column_bytes(pStmt,3);
588597
unsigned long int nOut2 = (unsigned long int)sz;
598
+ nFile++;
599
+ nByte += sz;
589600
blob_resize(&file, sz);
590601
if( nIn<sz ){
591602
rc = uncompress((unsigned char*)blob_buffer(&file), &nOut2,
592603
inBuf, nIn);
593604
if( rc!=Z_OK ){
@@ -607,6 +618,15 @@
607618
}
608619
}
609620
sqlite3_finalize(pStmt);
610621
sqlite3_close(db);
611622
blob_zero(&out);
623
+ if( !bVerbose && !bQuiet && nFile>0 && zDest ){
624
+ fossil_print("%d files (%,lld bytes) written into %s",
625
+ nFile, nByte, zDest);
626
+ if( nDir>1 ){
627
+ fossil_print(" and %d subdirectories\n", nDir-1);
628
+ }else{
629
+ fossil_print("\n");
630
+ }
631
+ }
612632
}
613633
--- src/checkout.c
+++ src/checkout.c
@@ -466,11 +466,13 @@
466 ** -v|--verbose Show all files as they are extracted
467 */
468 void get_cmd(void){
469 int forceFlag = find_option("force","f",0)!=0;
470 int bVerbose = find_option("verbose","v",0)!=0;
 
471 int bDebug = find_option("debug",0,0)!=0;
 
472 const char *zSqlArchive = find_option("sqlar",0,1);
473 const char *z;
474 char *zDest = 0; /* Where to store results */
475 const char *zUrl; /* Url to get */
476 const char *zVers; /* Version name to get */
@@ -478,10 +480,13 @@
478 Blob in, out; /* I/O for the HTTP request */
479 Blob file; /* A file to extract */
480 sqlite3 *db; /* Database containing downloaded sqlar */
481 sqlite3_stmt *pStmt; /* Statement for querying the database */
482 int rc; /* Result of subroutine calls */
 
 
 
483
484 z = find_option("dest",0,1);
485 if( z ) zDest = fossil_strdup(z);
486 verify_all_options();
487 if( g.argc<3 || g.argc>4 ){
@@ -536,11 +541,11 @@
536 }
537 }
538
539 /* Construct a subpath on the URL if necessary */
540 if( g.url.isSsh || g.url.isFile ){
541 g.url.subpath = mprintf("/sqlar?name=%t&r=%t", zDest, zVers);
542 }
543
544 if( bDebug ){
545 urlparse_print(0);
546 }
@@ -547,10 +552,11 @@
547
548 /* Fetch the ZIP archive for the requested check-in */
549 blob_init(&in, 0, 0);
550 blob_init(&out, 0, 0);
551 if( bDebug ) mHttpFlags |= HTTP_VERBOSE;
 
552 http_exchange(&in, &out, mHttpFlags, 4, 0);
553
554 if( zSqlArchive ){
555 blob_write_to_file(&out, zSqlArchive);
556 if( bVerbose ) fossil_print("%s\n", zSqlArchive);
@@ -576,18 +582,23 @@
576 blob_init(&file, 0, 0);
577 while( sqlite3_step(pStmt)==SQLITE_ROW ){
578 const char *zFilename = (const char*)sqlite3_column_text(pStmt, 0);
579 int mode = sqlite3_column_int(pStmt, 1);
580 int sz = sqlite3_column_int(pStmt, 2);
581 if( mode & 0x4000 ){
 
 
582 /* A directory name */
 
583 file_mkdir(zFilename, ExtFILE, 1);
584 }else{
585 /* A file */
586 unsigned char *inBuf = (unsigned char*)sqlite3_column_blob(pStmt,3);
587 unsigned int nIn = (unsigned int)sqlite3_column_bytes(pStmt,3);
588 unsigned long int nOut2 = (unsigned long int)sz;
 
 
589 blob_resize(&file, sz);
590 if( nIn<sz ){
591 rc = uncompress((unsigned char*)blob_buffer(&file), &nOut2,
592 inBuf, nIn);
593 if( rc!=Z_OK ){
@@ -607,6 +618,15 @@
607 }
608 }
609 sqlite3_finalize(pStmt);
610 sqlite3_close(db);
611 blob_zero(&out);
 
 
 
 
 
 
 
 
 
612 }
613
--- src/checkout.c
+++ src/checkout.c
@@ -466,11 +466,13 @@
466 ** -v|--verbose Show all files as they are extracted
467 */
468 void get_cmd(void){
469 int forceFlag = find_option("force","f",0)!=0;
470 int bVerbose = find_option("verbose","v",0)!=0;
471 int bQuiet = find_option("quiet","q",0)!=0;
472 int bDebug = find_option("debug",0,0)!=0;
473 int bList = find_option("list",0,0)!=0;
474 const char *zSqlArchive = find_option("sqlar",0,1);
475 const char *z;
476 char *zDest = 0; /* Where to store results */
477 const char *zUrl; /* Url to get */
478 const char *zVers; /* Version name to get */
@@ -478,10 +480,13 @@
480 Blob in, out; /* I/O for the HTTP request */
481 Blob file; /* A file to extract */
482 sqlite3 *db; /* Database containing downloaded sqlar */
483 sqlite3_stmt *pStmt; /* Statement for querying the database */
484 int rc; /* Result of subroutine calls */
485 int nFile = 0; /* Number of files written */
486 int nDir = 0; /* Number of directories written */
487 i64 nByte = 0; /* Number of bytes written */
488
489 z = find_option("dest",0,1);
490 if( z ) zDest = fossil_strdup(z);
491 verify_all_options();
492 if( g.argc<3 || g.argc>4 ){
@@ -536,11 +541,11 @@
541 }
542 }
543
544 /* Construct a subpath on the URL if necessary */
545 if( g.url.isSsh || g.url.isFile ){
546 g.url.subpath = mprintf("/sqlar/%t/%t.sqlar", zVers, zDest);
547 }
548
549 if( bDebug ){
550 urlparse_print(0);
551 }
@@ -547,10 +552,11 @@
552
553 /* Fetch the ZIP archive for the requested check-in */
554 blob_init(&in, 0, 0);
555 blob_init(&out, 0, 0);
556 if( bDebug ) mHttpFlags |= HTTP_VERBOSE;
557 if( bQuiet ) mHttpFlags |= HTTP_QUIET;
558 http_exchange(&in, &out, mHttpFlags, 4, 0);
559
560 if( zSqlArchive ){
561 blob_write_to_file(&out, zSqlArchive);
562 if( bVerbose ) fossil_print("%s\n", zSqlArchive);
@@ -576,18 +582,23 @@
582 blob_init(&file, 0, 0);
583 while( sqlite3_step(pStmt)==SQLITE_ROW ){
584 const char *zFilename = (const char*)sqlite3_column_text(pStmt, 0);
585 int mode = sqlite3_column_int(pStmt, 1);
586 int sz = sqlite3_column_int(pStmt, 2);
587 if( bList ){
588 fossil_print("%s\n", zFilename);
589 }else if( mode & 0x4000 ){
590 /* A directory name */
591 nDir++;
592 file_mkdir(zFilename, ExtFILE, 1);
593 }else{
594 /* A file */
595 unsigned char *inBuf = (unsigned char*)sqlite3_column_blob(pStmt,3);
596 unsigned int nIn = (unsigned int)sqlite3_column_bytes(pStmt,3);
597 unsigned long int nOut2 = (unsigned long int)sz;
598 nFile++;
599 nByte += sz;
600 blob_resize(&file, sz);
601 if( nIn<sz ){
602 rc = uncompress((unsigned char*)blob_buffer(&file), &nOut2,
603 inBuf, nIn);
604 if( rc!=Z_OK ){
@@ -607,6 +618,15 @@
618 }
619 }
620 sqlite3_finalize(pStmt);
621 sqlite3_close(db);
622 blob_zero(&out);
623 if( !bVerbose && !bQuiet && nFile>0 && zDest ){
624 fossil_print("%d files (%,lld bytes) written into %s",
625 nFile, nByte, zDest);
626 if( nDir>1 ){
627 fossil_print(" and %d subdirectories\n", nDir-1);
628 }else{
629 fossil_print("\n");
630 }
631 }
632 }
633
+8 -6
--- src/http.c
+++ src/http.c
@@ -686,16 +686,18 @@
686686
&& (g.url.flags & URL_SSH_EXE)==0 /* Does not have ?fossil=.... */
687687
&& (g.url.flags & URL_SSH_RETRY)==0 /* Not retried already */
688688
){
689689
/* Retry after flipping the SSH_PATH setting */
690690
transport_close(&g.url);
691
- fossil_print(
692
- "First attempt to run fossil on %s using SSH failed.\n"
693
- "Retrying %s the PATH= argument.\n",
694
- g.url.hostname,
695
- (g.url.flags & URL_SSH_PATH)!=0 ? "without" : "with"
696
- );
691
+ if( (mHttpFlags & HTTP_QUIET)==0 ){
692
+ fossil_print(
693
+ "First attempt to run fossil on %s using SSH failed.\n"
694
+ "Retrying %s the PATH= argument.\n",
695
+ g.url.hostname,
696
+ (g.url.flags & URL_SSH_PATH)!=0 ? "without" : "with"
697
+ );
698
+ }
697699
g.url.flags ^= URL_SSH_PATH|URL_SSH_RETRY;
698700
rc = http_exchange(pSend,pReply,mHttpFlags,0,zAltMimetype);
699701
if( rc==0 && g.db!=0 ){
700702
(void)ssh_needs_path_argument(g.url.hostname,
701703
(g.url.flags & URL_SSH_PATH)!=0);
702704
--- src/http.c
+++ src/http.c
@@ -686,16 +686,18 @@
686 && (g.url.flags & URL_SSH_EXE)==0 /* Does not have ?fossil=.... */
687 && (g.url.flags & URL_SSH_RETRY)==0 /* Not retried already */
688 ){
689 /* Retry after flipping the SSH_PATH setting */
690 transport_close(&g.url);
691 fossil_print(
692 "First attempt to run fossil on %s using SSH failed.\n"
693 "Retrying %s the PATH= argument.\n",
694 g.url.hostname,
695 (g.url.flags & URL_SSH_PATH)!=0 ? "without" : "with"
696 );
 
 
697 g.url.flags ^= URL_SSH_PATH|URL_SSH_RETRY;
698 rc = http_exchange(pSend,pReply,mHttpFlags,0,zAltMimetype);
699 if( rc==0 && g.db!=0 ){
700 (void)ssh_needs_path_argument(g.url.hostname,
701 (g.url.flags & URL_SSH_PATH)!=0);
702
--- src/http.c
+++ src/http.c
@@ -686,16 +686,18 @@
686 && (g.url.flags & URL_SSH_EXE)==0 /* Does not have ?fossil=.... */
687 && (g.url.flags & URL_SSH_RETRY)==0 /* Not retried already */
688 ){
689 /* Retry after flipping the SSH_PATH setting */
690 transport_close(&g.url);
691 if( (mHttpFlags & HTTP_QUIET)==0 ){
692 fossil_print(
693 "First attempt to run fossil on %s using SSH failed.\n"
694 "Retrying %s the PATH= argument.\n",
695 g.url.hostname,
696 (g.url.flags & URL_SSH_PATH)!=0 ? "without" : "with"
697 );
698 }
699 g.url.flags ^= URL_SSH_PATH|URL_SSH_RETRY;
700 rc = http_exchange(pSend,pReply,mHttpFlags,0,zAltMimetype);
701 if( rc==0 && g.db!=0 ){
702 (void)ssh_needs_path_argument(g.url.hostname,
703 (g.url.flags & URL_SSH_PATH)!=0);
704

Keyboard Shortcuts

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