Overview
SHA1 Hash: | 5bc5e88c86130400c184ba93b2470e7009f909c5 |
---|---|
Date: | 2009-08-14 16:19:53 |
User: | drh |
Comment: | Add the --dotfiles option to the "add" command to cause fossil to include
files whose name begins with "." which recursively adding files.
Ticket |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/add.c from [c6fe5d6e20] to [c094792c50].
@@ -27,10 +27,15 @@ #include "config.h" #include "add.h" #include <assert.h> #include <dirent.h> +/* +** Set to true if files whose names begin with "." should be +** included when processing a recursive "add" command. +*/ +static int includeDotFiles = 0; /* ** Add a single file */ static void add_one_file(const char *zName, int vid, Blob *pOmit){ @@ -75,11 +80,15 @@ origSize = blob_size(&path); d = opendir(zDir); if( d ){ while( (pEntry=readdir(d))!=0 ){ char *zPath; - if( pEntry->d_name[0]=='.' ) continue; + if( pEntry->d_name[0]=='.' ){ + if( !includeDotFiles ) continue; + if( pEntry->d_name[1]==0 ) continue; + if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue; + } blob_appendf(&path, "/%s", pEntry->d_name); zPath = blob_str(&path); if( file_isdir(zPath)==1 ){ add_directory_content(zPath); }else if( file_isfile(zPath) ){ @@ -112,16 +121,21 @@ ** ** Usage: %fossil add FILE... ** ** Make arrangements to add one or more files to the current checkout ** at the next commit. +** +** When adding files recursively, filenames that begin with "." are +** excluded by default. To include such files, add the "--dotfiles" +** option to the command-line. */ void add_cmd(void){ int i; int vid; Blob repo; + includeDotFiles = find_option("dotfiles",0,0)!=0; db_must_be_within_tree(); vid = db_lget_int("checkout",0); if( vid==0 ){ fossil_panic("no checkout to add to"); }