Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Never allow the "fossil open" command to proceed on a non-empty working directory unless either the --force or --keep options are used. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
99ab1118f57dcaf286b12dfba1beeaa9 |
| User & Date: | drh 2020-08-08 18:14:38.804 |
Context
|
2020-08-08
| ||
| 18:19 | Fix typo in built-in documentation for "fossil open". check-in: 9ec3274f35 user: drh tags: trunk | |
| 18:14 | Never allow the "fossil open" command to proceed on a non-empty working directory unless either the --force or --keep options are used. check-in: 99ab1118f5 user: drh tags: trunk | |
| 17:43 | Disabled wikiedit save confirmation, by popular demand. (Discard/reload still requires confirmation due to the risk of data loss.) Added link to /wiki/PageName to the per-page links. check-in: 8635cb3d17 user: stephan tags: trunk | |
Changes
Changes to src/db.c.
| ︙ | ︙ | |||
3080 3081 3082 3083 3084 3085 3086 | /* ** COMMAND: open ** ** Usage: %fossil open REPOSITORY ?VERSION? ?OPTIONS? ** ** Open a new connection to the repository name REPOSITORY. A checkout ** for the repository is created with its root at the current working | | | | > > > > > > | 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 |
/*
** COMMAND: open
**
** Usage: %fossil open REPOSITORY ?VERSION? ?OPTIONS?
**
** Open a new connection to the repository name REPOSITORY. A checkout
** for the repository is created with its root at the current working
** directory, or in DIR if the "--workdir DIR" is used. If VERSION is
** specified then that version is checked out. Otherwise the most recent
** check-in on the main branch (usually "trunk") is used.
**
** REPOSITORY can be the filename for a repository that already exists on the
** local machine or it can be a URI for a remote repository. If REPOSITORY
** is a URI, the remote repo is first cloned, then the clone is opened.
** The clone will be stored in the current directory, or in an alternative
** directory specified by the --repodir option. The name of the clone will
** be taken from the last term of the URI. For http: and https: URIs, you
** can append an extra term on the end to get any repository name you like.
** For example:
**
** fossil open https://fossil-scm.org/home/new-name
**
** The base URI for cloning is 'https://fossil-scm.org/home'. The extra
** 'new-name' term means that the cloned repository will be called
** 'new-name.fossil'.
**
** Note that
**
** Options:
** --empty Initialize checkout as being empty, but still connected
** with the local repository. If you commit this checkout,
** it will become a new "initial" commit in the repository.
** --force Continue with the open even if the working directory is
** not empy.
** --force-missing Force opening a repository with missing content
** --keep Only modify the manifest and manifest.uuid files
** --nested Allow opening a repository inside an opened checkout
** --repodir DIR If REPOSITORY is a URI that will be cloned, store
** the clone in DIR rather than in "."
** --setmtime Set timestamps of all files to match their SCM-side
** times (the timestamp of the last checkin which modified
** them).
** --workdir DIR Use DIR as the working directory instead of ".". The DIR
** directory is created if it does not previously exist.
**
** See also: close
*/
void cmd_open(void){
int emptyFlag;
int keepFlag;
int forceMissingFlag;
int allowNested;
int allowSymlinks;
int setmtimeFlag; /* --setmtime. Set mtimes on files */
int bForce = 0; /* --force. Open even if non-empty dir */
static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0, 0 };
const char *zWorkDir; /* --workdir value */
const char *zRepo = 0; /* Name of the repository file */
const char *zRepoDir = 0; /* --repodir value */
char *zPwd; /* Initial working directory */
int isUri = 0; /* True if REPOSITORY is a URI */
url_proxy_options();
emptyFlag = find_option("empty",0,0)!=0;
keepFlag = find_option("keep",0,0)!=0;
forceMissingFlag = find_option("force-missing",0,0)!=0;
allowNested = find_option("nested",0,0)!=0;
setmtimeFlag = find_option("setmtime",0,0)!=0;
zWorkDir = find_option("workdir",0,1);
zRepoDir = find_option("repodir",0,1);
bForce = find_option("force",0,0)!=0;
zPwd = file_getcwd(0,0);
/* We should be done with options.. */
verify_all_options();
if( g.argc!=3 && g.argc!=4 ){
|
| ︙ | ︙ | |||
3173 3174 3175 3176 3177 3178 3179 |
if( file_mkdir(zWorkDir, ExtFILE, 0) ){
fossil_fatal("cannot create directory %s", zWorkDir);
}
}
if( file_chdir(zWorkDir, 0) ){
fossil_fatal("unable to make %s the working directory", zWorkDir);
}
| > | | | | 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 |
if( file_mkdir(zWorkDir, ExtFILE, 0) ){
fossil_fatal("cannot create directory %s", zWorkDir);
}
}
if( file_chdir(zWorkDir, 0) ){
fossil_fatal("unable to make %s the working directory", zWorkDir);
}
}
if( keepFlag==0 && bForce==0 && file_directory_size(".", 0, 1)>0 ){
fossil_fatal("directory %s is not empty\n"
"use the --force option to override", file_getcwd(0,0));
}
if( db_open_local_v2(0, allowNested) ){
fossil_fatal("there is already an open tree at %s", g.zLocalRoot);
}
/* If REPOSITORY looks like a URI, then try to clone it first */
|
| ︙ | ︙ |