Fossil SCM
By default, the extras command lists all the uncontrolled files relative to the current working directory, unless the --non-relative option is used.
Commit
b9a38cf3673ccab549547e0bee0b9ad101eaaf56
Parent
a05bbff46acb849…
1 file changed
+19
-1
+19
-1
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -228,20 +228,26 @@ | ||
| 228 | 228 | ** ignored but can be included by adding the --dotfiles option. |
| 229 | 229 | ** |
| 230 | 230 | ** The GLOBPATTERN is a comma-separated list of GLOB expressions for |
| 231 | 231 | ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob" |
| 232 | 232 | ** is used if the --ignore option is omitted. |
| 233 | +** | |
| 234 | +** Filenames are displayed relative to the current working directory | |
| 235 | +** unless the --non-relative option is used. | |
| 233 | 236 | */ |
| 234 | 237 | void extra_cmd(void){ |
| 235 | 238 | Blob path; |
| 236 | 239 | Blob repo; |
| 237 | 240 | Stmt q; |
| 238 | 241 | int n; |
| 239 | 242 | const char *zIgnoreFlag = find_option("ignore",0,1); |
| 240 | 243 | int allFlag = find_option("dotfiles",0,0)!=0; |
| 244 | + int cwdRelative = !(find_option("non-relative", 0, 0)!=0); | |
| 241 | 245 | int outputManifest; |
| 242 | 246 | Glob *pIgnore; |
| 247 | + Blob rewrittenPathname; | |
| 248 | + const char *zPathname, *zDisplayName; | |
| 243 | 249 | |
| 244 | 250 | db_must_be_within_tree(); |
| 245 | 251 | outputManifest = db_get_boolean("manifest",0); |
| 246 | 252 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)"); |
| 247 | 253 | n = strlen(g.zLocalRoot); |
| @@ -259,13 +265,25 @@ | ||
| 259 | 265 | fossil_all_reserved_names() |
| 260 | 266 | ); |
| 261 | 267 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 262 | 268 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 263 | 269 | } |
| 270 | + blob_zero(&rewrittenPathname); | |
| 264 | 271 | while( db_step(&q)==SQLITE_ROW ){ |
| 265 | - fossil_print("%s\n", db_column_text(&q, 0)); | |
| 272 | + zDisplayName = zPathname = db_column_text(&q, 0); | |
| 273 | + if( cwdRelative ) { | |
| 274 | + char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname); | |
| 275 | + file_relative_name(zFullName, &rewrittenPathname); | |
| 276 | + free(zFullName); | |
| 277 | + zDisplayName = blob_str(&rewrittenPathname); | |
| 278 | + if( zDisplayName[0]=='.' && zDisplayName[1]=='/' ){ | |
| 279 | + zDisplayName += 2; /* no unnecessary ./ prefix */ | |
| 280 | + } | |
| 281 | + } | |
| 282 | + fossil_print("%s\n", zDisplayName); | |
| 266 | 283 | } |
| 284 | + blob_reset(&rewrittenPathname); | |
| 267 | 285 | db_finalize(&q); |
| 268 | 286 | } |
| 269 | 287 | |
| 270 | 288 | /* |
| 271 | 289 | ** COMMAND: clean |
| 272 | 290 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -228,20 +228,26 @@ | |
| 228 | ** ignored but can be included by adding the --dotfiles option. |
| 229 | ** |
| 230 | ** The GLOBPATTERN is a comma-separated list of GLOB expressions for |
| 231 | ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob" |
| 232 | ** is used if the --ignore option is omitted. |
| 233 | */ |
| 234 | void extra_cmd(void){ |
| 235 | Blob path; |
| 236 | Blob repo; |
| 237 | Stmt q; |
| 238 | int n; |
| 239 | const char *zIgnoreFlag = find_option("ignore",0,1); |
| 240 | int allFlag = find_option("dotfiles",0,0)!=0; |
| 241 | int outputManifest; |
| 242 | Glob *pIgnore; |
| 243 | |
| 244 | db_must_be_within_tree(); |
| 245 | outputManifest = db_get_boolean("manifest",0); |
| 246 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)"); |
| 247 | n = strlen(g.zLocalRoot); |
| @@ -259,13 +265,25 @@ | |
| 259 | fossil_all_reserved_names() |
| 260 | ); |
| 261 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 262 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 263 | } |
| 264 | while( db_step(&q)==SQLITE_ROW ){ |
| 265 | fossil_print("%s\n", db_column_text(&q, 0)); |
| 266 | } |
| 267 | db_finalize(&q); |
| 268 | } |
| 269 | |
| 270 | /* |
| 271 | ** COMMAND: clean |
| 272 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -228,20 +228,26 @@ | |
| 228 | ** ignored but can be included by adding the --dotfiles option. |
| 229 | ** |
| 230 | ** The GLOBPATTERN is a comma-separated list of GLOB expressions for |
| 231 | ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob" |
| 232 | ** is used if the --ignore option is omitted. |
| 233 | ** |
| 234 | ** Filenames are displayed relative to the current working directory |
| 235 | ** unless the --non-relative option is used. |
| 236 | */ |
| 237 | void extra_cmd(void){ |
| 238 | Blob path; |
| 239 | Blob repo; |
| 240 | Stmt q; |
| 241 | int n; |
| 242 | const char *zIgnoreFlag = find_option("ignore",0,1); |
| 243 | int allFlag = find_option("dotfiles",0,0)!=0; |
| 244 | int cwdRelative = !(find_option("non-relative", 0, 0)!=0); |
| 245 | int outputManifest; |
| 246 | Glob *pIgnore; |
| 247 | Blob rewrittenPathname; |
| 248 | const char *zPathname, *zDisplayName; |
| 249 | |
| 250 | db_must_be_within_tree(); |
| 251 | outputManifest = db_get_boolean("manifest",0); |
| 252 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)"); |
| 253 | n = strlen(g.zLocalRoot); |
| @@ -259,13 +265,25 @@ | |
| 265 | fossil_all_reserved_names() |
| 266 | ); |
| 267 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 268 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 269 | } |
| 270 | blob_zero(&rewrittenPathname); |
| 271 | while( db_step(&q)==SQLITE_ROW ){ |
| 272 | zDisplayName = zPathname = db_column_text(&q, 0); |
| 273 | if( cwdRelative ) { |
| 274 | char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname); |
| 275 | file_relative_name(zFullName, &rewrittenPathname); |
| 276 | free(zFullName); |
| 277 | zDisplayName = blob_str(&rewrittenPathname); |
| 278 | if( zDisplayName[0]=='.' && zDisplayName[1]=='/' ){ |
| 279 | zDisplayName += 2; /* no unnecessary ./ prefix */ |
| 280 | } |
| 281 | } |
| 282 | fossil_print("%s\n", zDisplayName); |
| 283 | } |
| 284 | blob_reset(&rewrittenPathname); |
| 285 | db_finalize(&q); |
| 286 | } |
| 287 | |
| 288 | /* |
| 289 | ** COMMAND: clean |
| 290 |