| | @@ -672,11 +672,11 @@ |
| 672 | 672 | ** option to locate the repository. If no such option is available, then |
| 673 | 673 | ** use the repository of the open checkout if there is one. |
| 674 | 674 | ** |
| 675 | 675 | ** Error out if the repository cannot be opened. |
| 676 | 676 | */ |
| 677 | | -void db_find_and_open_repository(void){ |
| 677 | +void db_find_and_open_repository(int errIfNotFound){ |
| 678 | 678 | const char *zRep = find_option("repository", "R", 1); |
| 679 | 679 | if( zRep==0 ){ |
| 680 | 680 | if( db_open_local()==0 ){ |
| 681 | 681 | goto rep_not_found; |
| 682 | 682 | } |
| | @@ -688,11 +688,13 @@ |
| 688 | 688 | db_open_repository(zRep); |
| 689 | 689 | if( g.repositoryOpen ){ |
| 690 | 690 | return; |
| 691 | 691 | } |
| 692 | 692 | rep_not_found: |
| 693 | | - fossil_fatal("use --repository or -R to specific the repository database"); |
| 693 | + if( errIfNotFound ){ |
| 694 | + fossil_fatal("use --repository or -R to specific the repository database"); |
| 695 | + } |
| 694 | 696 | } |
| 695 | 697 | |
| 696 | 698 | /* |
| 697 | 699 | ** Open the local database. If unable, exit with an error. |
| 698 | 700 | */ |
| | @@ -1036,16 +1038,23 @@ |
| 1036 | 1038 | /* |
| 1037 | 1039 | ** Print the value of a setting named zName |
| 1038 | 1040 | */ |
| 1039 | 1041 | static void print_setting(const char *zName){ |
| 1040 | 1042 | Stmt q; |
| 1041 | | - db_prepare(&q, |
| 1042 | | - "SELECT '(local)', value FROM config WHERE name=%Q" |
| 1043 | | - " UNION ALL " |
| 1044 | | - "SELECT '(global)', value FROM global_config WHERE name=%Q", |
| 1045 | | - zName, zName |
| 1046 | | - ); |
| 1043 | + if( g.repositoryOpen ){ |
| 1044 | + db_prepare(&q, |
| 1045 | + "SELECT '(local)', value FROM config WHERE name=%Q" |
| 1046 | + " UNION ALL " |
| 1047 | + "SELECT '(global)', value FROM global_config WHERE name=%Q", |
| 1048 | + zName, zName |
| 1049 | + ); |
| 1050 | + }else{ |
| 1051 | + db_prepare(&q, |
| 1052 | + "SELECT '(global)', value FROM global_config WHERE name=%Q", |
| 1053 | + zName |
| 1054 | + ); |
| 1055 | + } |
| 1047 | 1056 | if( db_step(&q)==SQLITE_ROW ){ |
| 1048 | 1057 | printf("%-20s %-8s %s\n", zName, db_column_text(&q, 0), |
| 1049 | 1058 | db_column_text(&q, 1)); |
| 1050 | 1059 | }else{ |
| 1051 | 1060 | printf("%-20s\n", zName); |
| | @@ -1098,11 +1107,15 @@ |
| 1098 | 1107 | "diff-command", |
| 1099 | 1108 | "gdiff-command", |
| 1100 | 1109 | }; |
| 1101 | 1110 | int i; |
| 1102 | 1111 | int globalFlag = find_option("global","g",0)!=0; |
| 1103 | | - db_find_and_open_repository(); |
| 1112 | + db_find_and_open_repository(0); |
| 1113 | + if( !g.repositoryOpen ){ |
| 1114 | + db_open_config(); |
| 1115 | + globalFlag = 1; |
| 1116 | + } |
| 1104 | 1117 | if( g.argc==2 ){ |
| 1105 | 1118 | for(i=0; i<sizeof(azName)/sizeof(azName[0]); i++){ |
| 1106 | 1119 | print_setting(azName[i]); |
| 1107 | 1120 | } |
| 1108 | 1121 | }else if( g.argc==3 || g.argc==4 ){ |
| 1109 | 1122 | |