Re: [PATCH v2 02/22] untracked cache: record .gitignore information and dir hierarchy

2014-11-17 Thread David Turner
On Sat, 2014-11-08 at 16:39 +0700, Nguyễn Thái Ngọc Duy wrote:
 + d = xmalloc(sizeof(*d) + len);
 + memset(d, 0, sizeof(*d) + len);
+  memcpy(d-name, name, len);

calloc instead of malloc+memset?  But do we really need this memset to
include name if we're about to use a memcpy? Couldn't we just add a
trailing zero?

 + *   - The list of files and directories of the direction in question

s/direction/directory/

 +struct untracked_cache_dir {
 + struct untracked_cache_dir **dirs;
 + char **untracked;
 + struct stat_data stat_data;
 + unsigned int untracked_alloc, dirs_nr, dirs_alloc;
 + unsigned int untracked_nr;
 + unsigned int check_only : 1;
 + /* null SHA-1 means this directory does not have .gitignore */
 + unsigned char exclude_sha1[20];
 + char name[1];

For consistency, should this be char name[FLEX_ARRAY]? (this will entail
some changes when allocating these, of course)


--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 02/22] untracked cache: record .gitignore information and dir hierarchy

2014-11-08 Thread brian m. carlson
On Sat, Nov 08, 2014 at 04:39:35PM +0700, Nguyễn Thái Ngọc Duy wrote:
 The requirement for this to work is stat info of a directory MUST
 change if an entry is added to or removed from that directory (and
 should not change often otherwise). If your OS and filesytem do not

Should be filesystem (or file system).

 meet this requirement, untracked cache is not for you. Most file
 systems on *nix should be fine. On Windows, NTFS is fine while FAT may
 be not [1] even though FAT on Linux seems to be fine.

Tiny nit: may be not should probably be may not be.
-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187


signature.asc
Description: Digital signature