Fossil

Check-in [5bc5e88c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add the --dotfiles option to the "add" command to cause fossil to include files whose name begins with "." which recursively adding files. Ticket [2e924cf9b74e].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5bc5e88c86130400c184ba93b2470e7009f909c5
User & Date: drh 2009-08-14 16:19:53
References
2009-08-14
16:20 Fixed ticket [2e924cf9]: Change recursive add to allow inclusion of files starting with dot plus 2 other changes artifact: decc0828 user: drh
Context
2009-08-15
02:17
Add an "extended timestamp" field to generated ZIP archives. The extended timestamp is in UTC so it does not mangle the time when the server and client are in different timezones. Ticket [28044ab5a42b75] check-in: 90048e0b user: drh tags: trunk
2009-08-14
16:19
Add the --dotfiles option to the "add" command to cause fossil to include files whose name begins with "." which recursively adding files. Ticket [2e924cf9b74e]. check-in: 5bc5e88c user: drh tags: trunk
14:03
Fix the header comment (and hence the "help" message) for the "fossil all" command. check-in: 0b49e4af user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/add.c.

25
26
27
28
29
30
31





32
33
34
35
36
37
38
..
73
74
75
76
77
78
79
80




81
82
83
84
85
86
87
...
110
111
112
113
114
115
116




117
118
119
120
121
122

123
124
125
126
127
128
129
** from the local repository.
*/
#include "config.h"
#include "add.h"
#include <assert.h>
#include <dirent.h>






    
/*
** Add a single file
*/
static void add_one_file(const char *zName, int vid, Blob *pOmit){
  Blob pathname;
  const char *zPath;
................................................................................
  blob_zero(&path);
  blob_append(&path, zDir, -1);
  origSize = blob_size(&path);
  d = opendir(zDir);
  if( d ){
    while( (pEntry=readdir(d))!=0 ){
      char *zPath;
      if( pEntry->d_name[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) ){
        db_multi_exec("INSERT INTO sfile VALUES(%Q)", zPath);
      }
................................................................................
/*
** COMMAND: add
**
** Usage: %fossil add FILE...
**
** Make arrangements to add one or more files to the current checkout 
** at the next commit.




*/
void add_cmd(void){
  int i;
  int vid;
  Blob repo;


  db_must_be_within_tree();
  vid = db_lget_int("checkout",0);
  if( vid==0 ){
    fossil_panic("no checkout to add to");
  }
  db_begin_transaction();
  if( !file_tree_name(g.zRepositoryName, &repo, 0) ){







>
>
>
>
>







 







|
>
>
>
>







 







>
>
>
>






>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
..
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
...
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
** from the local repository.
*/
#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){
  Blob pathname;
  const char *zPath;
................................................................................
  blob_zero(&path);
  blob_append(&path, zDir, -1);
  origSize = blob_size(&path);
  d = opendir(zDir);
  if( d ){
    while( (pEntry=readdir(d))!=0 ){
      char *zPath;
      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) ){
        db_multi_exec("INSERT INTO sfile VALUES(%Q)", zPath);
      }
................................................................................
/*
** COMMAND: add
**
** 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");
  }
  db_begin_transaction();
  if( !file_tree_name(g.zRepositoryName, &repo, 0) ){