Artifact b6933dbbc6d63ac1ec53e2cd7d2a1f12162e92b2:
Ticket change
[b6933dbbc6]
- Ticket 2e924cf9b7 Change recursive add to allow inclusion of files starting with dot status still Open with 2 other changes
by
drh on
2009-08-13 19:45:01.
0000: 44 20 32 30 30 39 2d 30 38 2d 31 33 54 31 39 3a D 2009-08-13T19:
0010: 34 35 3a 30 31 0a 4a 20 63 6f 6d 6d 65 6e 74 20 45:01.J comment
0020: 43 75 72 72 65 6e 74 6c 79 5c 73 61 5c 73 72 65 Currently\sa\sre
0030: 63 75 72 73 69 76 65 5c 73 61 64 64 5c 73 69 67 cursive\sadd\sig
0040: 6e 6f 72 65 73 5c 73 64 6f 74 66 69 6c 65 73 2e nores\sdotfiles.
0050: 5c 73 54 68 69 73 5c 73 69 73 5c 73 61 6e 6e 6f \sThis\sis\sanno
0060: 79 69 6e 67 5c 73 77 68 65 6e 5c 73 61 64 64 69 ying\swhen\saddi
0070: 6e 67 5c 73 66 6f 72 5c 73 69 6e 73 74 61 6e 63 ng\sfor\sinstanc
0080: 65 5c 73 61 6e 5c 73 65 63 6c 69 70 73 65 5c 73 e\san\seclipse\s
0090: 70 72 6f 6a 65 63 74 5c 73 6f 6e 5c 73 77 69 6e project\son\swin
00a0: 64 6f 77 73 5c 73 28 65 63 6c 69 70 73 65 5c 73 dows\s(eclipse\s
00b0: 75 73 65 73 5c 73 64 69 72 65 63 74 6f 72 69 65 uses\sdirectorie
00c0: 73 5c 73 73 74 61 72 74 69 6e 67 5c 73 77 69 74 s\sstarting\swit
00d0: 68 5c 73 2e 5c 73 66 6f 72 5c 73 70 72 6f 6a 65 h\s.\sfor\sproje
00e0: 63 74 5c 73 73 65 74 74 69 6e 67 73 29 5c 72 5c ct\ssettings)\r\
00f0: 6e 49 5c 73 70 72 6f 70 6f 73 65 5c 73 74 6f 5c nI\spropose\sto\
0100: 73 61 64 64 5c 73 61 5c 73 66 6c 61 67 5c 73 2d sadd\sa\sflag\s-
0110: 64 6f 74 66 69 6c 65 73 5c 73 74 6f 5c 73 61 64 dotfiles\sto\sad
0120: 64 5c 73 73 6f 5c 73 74 68 61 74 5c 73 77 68 65 d\sso\sthat\swhe
0130: 6e 5c 73 73 70 65 63 69 66 69 65 64 5c 73 2e 66 n\sspecified\s.f
0140: 69 6c 65 73 5c 73 61 6e 64 5c 73 2e 64 69 72 5c iles\sand\s.dir\
0150: 73 77 69 6c 6c 5c 73 62 65 5c 73 61 64 64 65 64 swill\sbe\sadded
0160: 5c 73 61 73 5c 73 77 65 6c 6c 2e 5c 72 5c 6e 46 \sas\swell.\r\nF
0170: 6f 6c 6c 6f 77 69 6e 67 5c 73 64 69 66 66 5c 73 ollowing\sdiff\s
0180: 61 64 64 73 5c 73 74 68 65 5c 73 6f 70 74 69 6f adds\sthe\soptio
0190: 6e 5c 73 74 6f 5c 73 66 6f 73 73 69 6c 5c 73 61 n\sto\sfossil\sa
01a0: 64 64 3a 5c 72 5c 6e 5c 72 5c 6e 3c 76 65 72 62 dd:\r\n\r\n<verb
01b0: 61 74 69 6d 3e 5c 72 5c 6e 40 40 5c 73 2d 36 35 atim>\r\n@@\s-65
01c0: 2c 32 31 5c 73 2b 36 35 2c 32 34 5c 73 40 40 5c ,21\s+65,24\s@@\
01d0: 72 5c 6e 5c 73 2a 2a 5c 73 41 6c 6c 5c 73 63 6f r\n\s**\sAll\sco
01e0: 6e 74 65 6e 74 5c 73 6f 66 5c 73 74 68 65 5c 73 ntent\sof\sthe\s
01f0: 7a 44 69 72 5c 73 64 69 72 65 63 74 6f 72 79 5c zDir\sdirectory\
0200: 73 74 6f 5c 73 74 68 65 5c 73 53 46 49 4c 45 5c sto\sthe\sSFILE\
0210: 73 74 61 62 6c 65 2e 5c 72 5c 6e 5c 73 2a 2f 5c stable.\r\n\s*/\
0220: 72 5c 6e 5c 73 76 6f 69 64 5c 73 61 64 64 5f 64 r\n\svoid\sadd_d
0230: 69 72 65 63 74 6f 72 79 5f 63 6f 6e 74 65 6e 74 irectory_content
0240: 28 63 6f 6e 73 74 5c 73 63 68 61 72 5c 73 2a 7a (const\schar\s*z
0250: 44 69 72 29 7b 5c 72 5c 6e 5c 73 5c 73 5c 73 44 Dir){\r\n\s\s\sD
0260: 49 52 5c 73 2a 64 3b 5c 72 5c 6e 5c 73 5c 73 5c IR\s*d;\r\n\s\s\
0270: 73 69 6e 74 5c 73 6f 72 69 67 53 69 7a 65 3b 5c sint\sorigSize;\
0280: 72 5c 6e 2b 5c 73 5c 73 69 6e 74 5c 73 64 6f 74 r\n+\s\sint\sdot
0290: 46 6c 61 67 3b 5c 72 5c 6e 5c 73 5c 73 5c 73 73 Flag;\r\n\s\s\ss
02a0: 74 72 75 63 74 5c 73 64 69 72 65 6e 74 5c 73 2a truct\sdirent\s*
02b0: 70 45 6e 74 72 79 3b 5c 72 5c 6e 5c 73 5c 73 5c pEntry;\r\n\s\s\
02c0: 73 42 6c 6f 62 5c 73 70 61 74 68 3b 5c 72 5c 6e sBlob\spath;\r\n
02d0: 2b 5c 73 5c 73 64 6f 74 46 6c 61 67 5c 73 3d 5c +\s\sdotFlag\s=\
02e0: 73 66 69 6e 64 5f 6f 70 74 69 6f 6e 28 22 64 6f sfind_option("do
02f0: 74 66 69 6c 65 73 22 2c 22 64 22 2c 30 29 21 3d tfiles","d",0)!=
0300: 30 3b 5c 72 5c 6e 5c 73 5c 72 5c 6e 5c 73 5c 73 0;\r\n\s\r\n\s\s
0310: 5c 73 62 6c 6f 62 5f 7a 65 72 6f 28 26 70 61 74 \sblob_zero(&pat
0320: 68 29 3b 5c 72 5c 6e 5c 73 5c 73 5c 73 62 6c 6f h);\r\n\s\s\sblo
0330: 62 5f 61 70 70 65 6e 64 28 26 70 61 74 68 2c 5c b_append(&path,\
0340: 73 7a 44 69 72 2c 5c 73 2d 31 29 3b 5c 72 5c 6e szDir,\s-1);\r\n
0350: 5c 73 5c 73 5c 73 6f 72 69 67 53 69 7a 65 5c 73 \s\s\sorigSize\s
0360: 3d 5c 73 62 6c 6f 62 5f 73 69 7a 65 28 26 70 61 =\sblob_size(&pa
0370: 74 68 29 3b 5c 72 5c 6e 5c 73 5c 73 5c 73 64 5c th);\r\n\s\s\sd\
0380: 73 3d 5c 73 6f 70 65 6e 64 69 72 28 7a 44 69 72 s=\sopendir(zDir
0390: 29 3b 5c 72 5c 6e 5c 73 5c 73 5c 73 69 66 28 5c );\r\n\s\s\sif(\
03a0: 73 64 5c 73 29 7b 5c 72 5c 6e 5c 73 5c 73 5c 73 sd\s){\r\n\s\s\s
03b0: 5c 73 5c 73 77 68 69 6c 65 28 5c 73 28 70 45 6e \s\swhile(\s(pEn
03c0: 74 72 79 3d 72 65 61 64 64 69 72 28 64 29 29 21 try=readdir(d))!
03d0: 3d 30 5c 73 29 7b 5c 72 5c 6e 5c 73 5c 73 5c 73 =0\s){\r\n\s\s\s
03e0: 5c 73 5c 73 5c 73 5c 73 63 68 61 72 5c 73 2a 7a \s\s\s\schar\s*z
03f0: 50 61 74 68 3b 5c 72 5c 6e 2d 5c 73 5c 73 5c 73 Path;\r\n-\s\s\s
0400: 5c 73 5c 73 5c 73 69 66 28 5c 73 70 45 6e 74 72 \s\s\sif(\spEntr
0410: 79 2d 3e 64 5f 6e 61 6d 65 5b 30 5d 3d 3d 27 2e y->d_name[0]=='.
0420: 27 5c 73 29 5c 73 63 6f 6e 74 69 6e 75 65 3b 5c '\s)\scontinue;\
0430: 72 5c 6e 2b 5c 73 5c 73 5c 73 5c 73 5c 73 5c 73 r\n+\s\s\s\s\s\s
0440: 69 66 28 5c 73 70 45 6e 74 72 79 2d 3e 64 5f 6e if(\spEntry->d_n
0450: 61 6d 65 5b 30 5d 3d 3d 27 2e 27 5c 73 26 26 5c ame[0]=='.'\s&&\
0460: 73 21 64 6f 74 46 6c 61 67 29 5c 73 63 6f 6e 74 s!dotFlag)\scont
0470: 69 6e 75 65 3b 5c 72 5c 6e 2b 5c 73 5c 73 5c 73 inue;\r\n+\s\s\s
0480: 5c 73 5c 73 5c 73 69 66 28 5c 73 73 74 72 63 6d \s\s\sif(\sstrcm
0490: 70 28 70 45 6e 74 72 79 2d 3e 64 5f 6e 61 6d 65 p(pEntry->d_name
04a0: 2c 5c 73 22 2e 2e 22 29 3d 3d 30 5c 73 7c 7c 5c ,\s"..")==0\s||\
04b0: 73 5c 73 73 74 72 63 6d 70 28 70 45 6e 74 72 79 s\sstrcmp(pEntry
04c0: 2d 3e 64 5f 6e 61 6d 65 2c 5c 73 22 2e 22 29 3d ->d_name,\s".")=
04d0: 3d 30 5c 73 29 5c 73 63 6f 6e 74 69 6e 75 65 3b =0\s)\scontinue;
04e0: 5c 72 5c 6e 5c 73 5c 73 5c 73 5c 73 5c 73 5c 73 \r\n\s\s\s\s\s\s
04f0: 5c 73 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28 26 \sblob_appendf(&
0500: 70 61 74 68 2c 5c 73 22 2f 25 73 22 2c 5c 73 70 path,\s"/%s",\sp
0510: 45 6e 74 72 79 2d 3e 64 5f 6e 61 6d 65 29 3b 5c Entry->d_name);\
0520: 72 5c 6e 5c 73 5c 73 5c 73 5c 73 5c 73 5c 73 5c r\n\s\s\s\s\s\s\
0530: 73 7a 50 61 74 68 5c 73 3d 5c 73 62 6c 6f 62 5f szPath\s=\sblob_
0540: 73 74 72 28 26 70 61 74 68 29 3b 5c 72 5c 6e 5c str(&path);\r\n\
0550: 73 5c 73 5c 73 5c 73 5c 73 5c 73 5c 73 69 66 28 s\s\s\s\s\s\sif(
0560: 5c 73 66 69 6c 65 5f 69 73 64 69 72 28 7a 50 61 \sfile_isdir(zPa
0570: 74 68 29 3d 3d 31 5c 73 29 7b 5c 72 5c 6e 5c 73 th)==1\s){\r\n\s
0580: 5c 73 5c 73 5c 73 5c 73 5c 73 5c 73 5c 73 5c 73 \s\s\s\s\s\s\s\s
0590: 61 64 64 5f 64 69 72 65 63 74 6f 72 79 5f 63 6f add_directory_co
05a0: 6e 74 65 6e 74 28 7a 50 61 74 68 29 3b 5c 72 5c ntent(zPath);\r\
05b0: 6e 5c 73 5c 73 5c 73 5c 73 5c 73 5c 73 5c 73 7d n\s\s\s\s\s\s\s}
05c0: 65 6c 73 65 5c 73 69 66 28 5c 73 66 69 6c 65 5f else\sif(\sfile_
05d0: 69 73 66 69 6c 65 28 7a 50 61 74 68 29 5c 73 29 isfile(zPath)\s)
05e0: 7b 5c 72 5c 6e 40 40 5c 73 2d 31 31 32 2c 31 30 {\r\n@@\s-112,10
05f0: 5c 73 2b 31 31 35 2c 31 34 5c 73 40 40 5c 72 5c \s+115,14\s@@\r\
0600: 6e 5c 73 2a 2a 5c 72 5c 6e 5c 73 2a 2a 5c 73 55 n\s**\r\n\s**\sU
0610: 73 61 67 65 3a 5c 73 25 66 6f 73 73 69 6c 5c 73 sage:\s%fossil\s
0620: 61 64 64 5c 73 46 49 4c 45 2e 2e 2e 5c 72 5c 6e add\sFILE...\r\n
0630: 5c 73 2a 2a 5c 72 5c 6e 5c 73 2a 2a 5c 73 4d 61 \s**\r\n\s**\sMa
0640: 6b 65 5c 73 61 72 72 61 6e 67 65 6d 65 6e 74 73 ke\sarrangements
0650: 5c 73 74 6f 5c 73 61 64 64 5c 73 6f 6e 65 5c 73 \sto\sadd\sone\s
0660: 6f 72 5c 73 6d 6f 72 65 5c 73 66 69 6c 65 73 5c or\smore\sfiles\
0670: 73 74 6f 5c 73 74 68 65 5c 73 63 75 72 72 65 6e sto\sthe\scurren
0680: 74 5c 73 63 68 65 63 6b 6f 75 74 5c 72 5c 6e 5c t\scheckout\r\n\
0690: 73 2a 2a 5c 73 61 74 5c 73 74 68 65 5c 73 6e 65 s**\sat\sthe\sne
06a0: 78 74 5c 73 63 6f 6d 6d 69 74 2e 5c 72 5c 6e 2b xt\scommit.\r\n+
06b0: 2a 2a 5c 72 5c 6e 2b 2a 2a 5c 73 57 68 65 6e 5c **\r\n+**\sWhen\
06c0: 73 61 64 64 69 6e 67 5c 73 66 69 6c 65 73 5c 73 sadding\sfiles\s
06d0: 72 65 63 75 72 73 69 76 65 6c 79 2c 5c 73 62 79 recursively,\sby
06e0: 5c 73 64 65 66 61 75 6c 74 5c 73 66 69 6c 65 73 \sdefault\sfiles
06f0: 5c 73 6f 72 5c 73 64 69 72 65 63 74 6f 72 69 65 \sor\sdirectorie
0700: 73 5c 72 5c 6e 2b 2a 2a 5c 73 73 74 61 72 74 69 s\r\n+**\sstarti
0710: 6e 67 5c 73 77 69 74 68 5c 73 61 5c 73 2e 5c 73 ng\swith\sa\s.\s
0720: 28 64 6f 74 29 2c 5c 73 77 69 6c 6c 5c 73 6e 6f (dot),\swill\sno
0730: 74 5c 73 62 65 5c 73 61 64 64 65 64 2e 5c 73 54 t\sbe\sadded.\sT
0740: 68 69 73 5c 73 62 65 68 61 76 69 6f 75 72 5c 73 his\sbehaviour\s
0750: 63 61 6e 5c 73 62 65 5c 73 63 68 61 6e 67 65 64 can\sbe\schanged
0760: 5c 72 5c 6e 2b 2a 2a 5c 73 62 79 5c 73 74 68 65 \r\n+**\sby\sthe
0770: 5c 73 6f 70 74 69 6f 6e 61 6c 5c 73 2d 64 6f 74 \soptional\s-dot
0780: 66 69 6c 65 73 5c 73 66 6c 61 67 2e 5c 72 5c 6e files\sflag.\r\n
0790: 5c 73 2a 2f 5c 72 5c 6e 5c 73 76 6f 69 64 5c 73 \s*/\r\n\svoid\s
07a0: 61 64 64 5f 63 6d 64 28 76 6f 69 64 29 7b 5c 72 add_cmd(void){\r
07b0: 5c 6e 5c 73 5c 73 5c 73 69 6e 74 5c 73 69 3b 5c \n\s\s\sint\si;\
07c0: 72 5c 6e 5c 73 5c 73 5c 73 69 6e 74 5c 73 76 69 r\n\s\s\sint\svi
07d0: 64 3b 5c 72 5c 6e 5c 73 5c 73 5c 73 42 6c 6f 62 d;\r\n\s\s\sBlob
07e0: 5c 73 72 65 70 6f 3b 5c 72 5c 6e 3c 2f 76 65 72 \srepo;\r\n</ver
07f0: 62 61 74 69 6d 3e 0a 4a 20 72 65 73 6f 6c 75 74 batim>.J resolut
0800: 69 6f 6e 20 4f 70 65 6e 0a 4b 20 32 65 39 32 34 ion Open.K 2e924
0810: 63 66 39 62 37 34 65 37 62 63 37 37 37 63 30 66 cf9b74e7bc777c0f
0820: 38 39 36 65 64 61 30 33 34 39 65 31 62 66 31 32 896eda0349e1bf12
0830: 33 63 37 0a 55 20 64 72 68 0a 5a 20 65 34 62 33 3c7.U drh.Z e4b3
0840: 63 64 61 39 65 33 63 34 66 32 31 30 35 36 64 66 cda9e3c4f21056df
0850: 30 35 65 33 35 32 32 64 64 38 31 31 0a 05e3522dd811.