Fossil SCM

If the fossil binary is launched with no command-line arguments, check to see if there is an appended repository and if there is, run "ui" against that repository.

drh 2018-05-14 00:55 UTC trunk
Commit 517fe07621ae50ae5f504901d2d5155831645ce173872db9b23f45eec998339b
1 file changed +22 -1
+22 -1
--- src/main.c
+++ src/main.c
@@ -534,10 +534,31 @@
534534
g.comFmtFlags = atoi(zValue);
535535
}else{
536536
g.comFmtFlags = COMMENT_PRINT_DEFAULT;
537537
}
538538
}
539
+
540
+/*
541
+** Check to see if the Fossil binary contains an appended repository
542
+** file using the appendvfs extension. If so, change command-line arguments
543
+** to cause Fossil to launch with "fossil ui" on that repo.
544
+*/
545
+static int fossilExeHasAppendedRepo(void){
546
+ extern int deduceDatabaseType(const char*,int);
547
+ if( 2==deduceDatabaseType(g.nameOfExe,0) ){
548
+ static char *azAltArgv[] = { 0, "ui", 0, 0 };
549
+ sqlite3_appendvfs_init(0,0,0);
550
+ g.zVfsName = "apndvfs";
551
+ azAltArgv[0] = g.nameOfExe;
552
+ azAltArgv[2] = g.nameOfExe;
553
+ g.argv = azAltArgv;
554
+ g.argc = 3;
555
+ return 1;
556
+ }else{
557
+ return 0;
558
+ }
559
+}
539560
540561
/*
541562
** This procedure runs first.
542563
*/
543564
#if defined(_WIN32) && !defined(BROKEN_MINGW_CMDLINE)
@@ -598,11 +619,11 @@
598619
}
599620
}
600621
if( fossil_getenv("GATEWAY_INTERFACE")!=0 && !find_option("nocgi", 0, 0)){
601622
zCmdName = "cgi";
602623
g.isHTTP = 1;
603
- }else if( g.argc<2 ){
624
+ }else if( g.argc<2 && !fossilExeHasAppendedRepo() ){
604625
fossil_print(
605626
"Usage: %s COMMAND ...\n"
606627
" or: %s help -- for a list of common commands\n"
607628
" or: %s help COMMAND -- for help with the named command\n",
608629
g.argv[0], g.argv[0], g.argv[0]);
609630
--- src/main.c
+++ src/main.c
@@ -534,10 +534,31 @@
534 g.comFmtFlags = atoi(zValue);
535 }else{
536 g.comFmtFlags = COMMENT_PRINT_DEFAULT;
537 }
538 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
539
540 /*
541 ** This procedure runs first.
542 */
543 #if defined(_WIN32) && !defined(BROKEN_MINGW_CMDLINE)
@@ -598,11 +619,11 @@
598 }
599 }
600 if( fossil_getenv("GATEWAY_INTERFACE")!=0 && !find_option("nocgi", 0, 0)){
601 zCmdName = "cgi";
602 g.isHTTP = 1;
603 }else if( g.argc<2 ){
604 fossil_print(
605 "Usage: %s COMMAND ...\n"
606 " or: %s help -- for a list of common commands\n"
607 " or: %s help COMMAND -- for help with the named command\n",
608 g.argv[0], g.argv[0], g.argv[0]);
609
--- src/main.c
+++ src/main.c
@@ -534,10 +534,31 @@
534 g.comFmtFlags = atoi(zValue);
535 }else{
536 g.comFmtFlags = COMMENT_PRINT_DEFAULT;
537 }
538 }
539
540 /*
541 ** Check to see if the Fossil binary contains an appended repository
542 ** file using the appendvfs extension. If so, change command-line arguments
543 ** to cause Fossil to launch with "fossil ui" on that repo.
544 */
545 static int fossilExeHasAppendedRepo(void){
546 extern int deduceDatabaseType(const char*,int);
547 if( 2==deduceDatabaseType(g.nameOfExe,0) ){
548 static char *azAltArgv[] = { 0, "ui", 0, 0 };
549 sqlite3_appendvfs_init(0,0,0);
550 g.zVfsName = "apndvfs";
551 azAltArgv[0] = g.nameOfExe;
552 azAltArgv[2] = g.nameOfExe;
553 g.argv = azAltArgv;
554 g.argc = 3;
555 return 1;
556 }else{
557 return 0;
558 }
559 }
560
561 /*
562 ** This procedure runs first.
563 */
564 #if defined(_WIN32) && !defined(BROKEN_MINGW_CMDLINE)
@@ -598,11 +619,11 @@
619 }
620 }
621 if( fossil_getenv("GATEWAY_INTERFACE")!=0 && !find_option("nocgi", 0, 0)){
622 zCmdName = "cgi";
623 g.isHTTP = 1;
624 }else if( g.argc<2 && !fossilExeHasAppendedRepo() ){
625 fossil_print(
626 "Usage: %s COMMAND ...\n"
627 " or: %s help -- for a list of common commands\n"
628 " or: %s help COMMAND -- for help with the named command\n",
629 g.argv[0], g.argv[0], g.argv[0]);
630

Keyboard Shortcuts

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