Differences From:
File
src/db.c
part of check-in
[dbda8d6ce9]
- Initial check-in of m1 sources.
by
drh on
2007-07-21 14:10:57.
[view]
To:
File
src/db.c
part of check-in
[916b6e4b3b]
- Improvements to web-based user management.
by
drh on
2007-07-21 19:32:06.
[view]
@@ -573,21 +573,32 @@
**
** Error out if the repository cannot be opened.
*/
void db_find_and_open_repository(void){
- db_open_repository(find_option("repository", "R", 1));
- if( g.repositoryOpen==0 ){
- fossil_fatal("use --repository or -R to specific the repository database");
+ char *zRep = find_option("repository", "R", 1);
+ if( zRep==0 ){
+ if( db_open_local()==0 ){
+ goto rep_not_found;
+ }
+ zRep = db_lget("repository", 0);
+ if( zRep==0 ){
+ goto rep_not_found;
+ }
+ }
+ db_open_repository(zRep);
+ if( g.repositoryOpen ){
+ return;
}
+rep_not_found:
+ fossil_fatal("use --repository or -R to specific the repository database");
}
/*
** Open the local database. If unable, exit with an error.
*/
void db_must_be_within_tree(void){
if( db_open_local()==0 ){
- fprintf(stderr,"%s: not within an open checkout\n", g.argv[0]);
- exit(1);
+ fossil_fatal("not within an open checkout");
}
db_open_repository(0);
}