nd/untracked-cache updates
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest23 patches 9 repliesIn review
- v222 patches 12 repliesSuperseded
- v119 patches 10 repliesSuperseded
Patches in v3 No applies recorded yet
Reviews trailers per patch
None of the 23 patches has a Reviewed-by or Acked-by.
| Patch | Eric Sunshine | Junio C Hamano | Torsten Bögershausen | David Turner | Ramsay Jones |
|---|---|---|---|---|---|
| 1/23 | Helped-by | Helped-by | |||
| 2/23 | Helped-by | Helped-by | |||
| 3/23 | |||||
| 4/23 | |||||
| 5/23 | Helped-by | ||||
| 6/23 | Helped-by | ||||
| 7/23 | |||||
| 8/23 | |||||
| 9/23 | |||||
| 10/23 | |||||
| 11/23 | |||||
| 12/23 | |||||
| 13/23 | |||||
| 14/23 | |||||
| 15/23 | |||||
| 16/23 | |||||
| 17/23 | |||||
| 18/23 | |||||
| 19/23 | |||||
| 20/23 | Helped-by | ||||
| 21/23 | |||||
| 22/23 | Helped-by | ||||
| 23/23 | Helped-by |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.
Cover letter [PATCH v3 00/23] nd/untracked-cache updates
Compare to v1 (the one on 'pu' as v2 never got to 'pu'):
- New cleanup patch 09/23
- New patch 17/23 allows to ignore untracked cache without destroying it (for comparison and verification)
- New patches 22/23 and 23/23 add some protection against filesystem or operating system changes
- Document UNTR extension
- Reorganize UNTR to avoid saving SHA-1/stat data when it's useless
- Fix writing UNTR to base index in split index mode
- Various review comments since v1
-- 8< --
Documentation/technical/index-format.txt +61 -0
@@ -233,3 +233,64 @@ Git index format The remaining index entries after replaced ones will be added to the final index. These added entries are also sorted by entry namme then stage. + +== Untracked cache + + Untracked cache saves the untracked file list and necessary data to + verify the cache. The signature for this extension is { 'U', 'N', + 'T', 'R' }. + + The extension starts with + + - A NUL-terminated string describing the environment when the cache + is created. + + - Stat data of $GIT_DIR/info/exclude. See "Index entry" section from + ctime field until "file size". + + - Stat data of core.excludesfile + + - 32-bit dir_flags (see struct dir_struct) + + - 160-bit SHA-1 of $GIT_DIR/info/exclude. Null SHA-1 means the file + does not exist. + + - 160-bit SHA-1 of core.excludesfile. Null SHA-1 means the file does + not exist. + + - NUL-terminated string of per-dir exclude file name. This usually + is ".gitignore". + + - The number of following directory blocks, variable width + encoding. If this number is zero, the extension ends here with a + following NUL. + + - A number of directory blocks in depth-first-search order, each + consists of + + - The number of untracked entries, variable witdh encoding. + + - The number of sub-directory blocks, variable with encoding. + + - The directory name terminated by NUL. + + - A number of untrached file/dir names terminated by NUL. + +The remaining data of each directory block is grouped by type: + + - An ewah bitmap, the n-th bit marks whether the n-th directory has + valid untracked cache entries. + + - An ewah bitmap, the n-th bit records "check-only" bit of + read_directory_recursive() for the n-th directory. + + - An ewah bitmap, the n-th bit indicates whether SHA-1 and stat data + is valid for the n-th directory and exists in the next data. + + - An array of stat data. The n-th data corresponds with the n-th + "one" bit in the previous ewah bitmap. + + - An array of SHA-1. The n-th SHA-1 corresponds with the n-th "one" bit + in the previous ewah bitmap. + + - One NUL.
builtin/update-index.c +4 -2
@@ -115,6 +115,7 @@ static int test_if_untracked_cache_is_supported(void) fd =create_file ("dir-mtime-test/newfile" );xstat ("dir-mtime-test" , &st);if (!match_stat_data (&base, &st)) { +close (fd);fputc ('\n' , stderr);fprintf_ln (stderr,_ ("directory stat info does not " "change after adding a new file" ));
@@ -127,6 +128,7 @@ static int test_if_untracked_cache_is_supported(void)xmkdir ("dir-mtime-test/new-dir" );xstat ("dir-mtime-test" , &st);if (!match_stat_data (&base, &st)) { +close (fd);fputc ('\n' , stderr);fprintf_ln (stderr,_ ("directory stat info does not change " "after adding a new directory" ));
@@ -1094,10 +1096,10 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)/* should be the same flags used by git-status */ uc->dir_flags =DIR_SHOW_OTHER_DIRECTORIES |DIR_HIDE_EMPTY_DIRECTORIES ; the_index.untracked = uc; - the_index.cache_changed |=SOMETHING_CHANGED ; + the_index.cache_changed |=UNTRACKED_CHANGED ; }else if (!untracked_cache && the_index.untracked) { the_index.untracked =NULL ; - the_index.cache_changed |=SOMETHING_CHANGED ; + the_index.cache_changed |=UNTRACKED_CHANGED ; }if (active_cache_changed) {
cache.h +1 -1
@@ -295,7 +295,7 @@ static inline unsigned int canon_mode(unsigned int mode)#define RESOLVE_UNDO_CHANGED (1 << 4)#define CACHE_TREE_CHANGED (1 << 5)#define SPLIT_INDEX_ORDERED (1 << 6) -#define UNTRACKED_CHANGED (1 << 7) +#define UNTRACKED_CHANGED (1 << 7)struct split_index ;struct untracked_cache ;
compat/mingw.c +11 -0
@@ -2128,3 +2128,14 @@ void mingw_startup()/* initialize Unicode console */ winansi_init (); } + +int uname (struct utsname *buf) +{ +DWORD v =GetVersion (); +memset (buf,0 ,sizeof (*buf)); +strcpy (buf->sysname,"Windows" ); +sprintf (buf->release,"%u.%u" , v &0xff , (v >>8 ) &0xff ); +/* assuming NT variants only.. */ +sprintf (buf->version,"%u" , (v >>16 ) &0x7fff ); +return 0 ; +}
compat/mingw.h +9 -0
@@ -77,6 +77,14 @@ struct itimerval { };#define ITIMER_REAL 0 +struct utsname { +char sysname[16 ]; +char nodename[1 ]; +char release[16 ]; +char version[16 ]; +char machine[1 ]; +}; +/* * sanitize preprocessor namespace polluted by Windows headers defining * macros which collide with git local versions
@@ -166,6 +174,7 @@ struct passwd *getpwuid(uid_t uid);int setitimer (int type,struct itimerval *in,struct itimerval *out);int sigaction (int sig,struct sigaction *in,struct sigaction *out);int link (const char *oldpath,const char *newpath); +int uname (struct utsname *buf);/* * replacements of existing functions
dir.c +260 -105
598 lines not on this page · raw message
dir.h +8 -8
@@ -77,6 +77,7 @@ struct exclude_list_group {struct sha1_stat {struct stat_data stat;unsigned char sha1[20 ]; +int valid; };/*
@@ -85,7 +86,7 @@ struct sha1_stat {* The following inputs are sufficient to determine what files in a * directory are excluded: * -* - The list of files and directories of the direction in question +* - The list of files and directories of the directory in question * - The $GIT_DIR/index * - dir_struct flags * - The content of $GIT_DIR/info/exclude
@@ -110,16 +111,16 @@ struct sha1_stat {struct untracked_cache_dir {struct untracked_cache_dir **dirs;char **untracked; -/* null SHA-1 means this directory does not have .gitignore */ -unsigned char exclude_sha1[20 ];struct stat_data stat_data; -unsigned int recurse :1 ; +unsigned int untracked_alloc, dirs_nr, dirs_alloc; +unsigned int untracked_nr;unsigned int check_only :1 ;/* all data except 'dirs' in this struct are good */ unsigned int valid :1 ; -unsigned int untracked_nr :29 ; -unsigned int untracked_alloc, dirs_nr, dirs_alloc; -char name[1 ]; +unsigned int recurse :1 ; +/* null SHA-1 means this directory does not have .gitignore */ +unsigned char exclude_sha1[20 ]; +char name[FLEX_ARRAY ]; };struct untracked_cache {
@@ -137,7 +138,6 @@ struct untracked_cache {int gitignore_invalidated;int dir_invalidated;int dir_opened; -int loaded; };struct dir_struct {
ewah/ewah_io.c +13 -0
@@ -19,6 +19,7 @@*/ #include "git-compat-util.h" #include "ewok.h" +#include "strbuf.h" int ewah_serialize_native (struct ewah_bitmap *self,int fd) {
@@ -110,6 +111,18 @@ int ewah_serialize(struct ewah_bitmap *self, int fd)return ewah_serialize_to (self, write_helper, (void *)(intptr_t )fd); } +static int write_strbuf (void *user_data,const void *data,size_t len) +{ +struct strbuf *sb = user_data; +strbuf_add (sb, data, len); +return len; +} + +int ewah_serialize_strbuf (struct ewah_bitmap *self,struct strbuf *sb) +{ +return ewah_serialize_to (self, write_strbuf, sb); +} +int ewah_read_mmap (struct ewah_bitmap *self,const void *map,size_t len) {const uint8_t *ptr = map;
ewah/ewok.h +2 -0
@@ -30,6 +30,7 @@# define ewah_calloc xcalloc#endif +struct strbuf ;typedef uint64_t eword_t ;#define BITS_IN_WORD (sizeof(eword_t) * 8)
@@ -97,6 +98,7 @@ int ewah_serialize_to(struct ewah_bitmap *self, void *out);int ewah_serialize (struct ewah_bitmap *self,int fd);int ewah_serialize_native (struct ewah_bitmap *self,int fd); +int ewah_serialize_strbuf (struct ewah_bitmap *self,struct strbuf *);int ewah_deserialize (struct ewah_bitmap *self,int fd);int ewah_read_mmap (struct ewah_bitmap *self,const void *map,size_t len);
git-compat-util.h +1 -0
@@ -132,6 +132,7 @@#elif defined(_MSC_VER)#include "compat/msvc.h" #else +#include <sys/utsname.h> #include <sys/wait.h> #include <sys/resource.h> #include <sys/socket.h>
read-cache.c +1 -1
@@ -2040,7 +2040,7 @@ static int do_write_index(struct index_state *istate, int newfd,if (err)return -1 ; } -if (istate->untracked) { +if (!strip_extensions && istate->untracked) {struct strbuf sb =STRBUF_INIT ;write_untracked_extension (&sb, istate->untracked);
split-index.c +2 -9
@@ -41,13 +41,6 @@ int read_link_extension(struct index_state *istate,return 0 ; } -static int write_strbuf (void *user_data,const void *data,size_t len) -{ -struct strbuf *sb = user_data; -strbuf_add (sb, data, len); -return len; -} -int write_link_extension (struct strbuf *sb,struct index_state *istate) {
@@ -55,8 +48,8 @@ int write_link_extension(struct strbuf *sb,strbuf_add (sb, si->base_sha1,20 );if (!si->delete_bitmap && !si->replace_bitmap)return 0 ; -ewah_serialize_to (si->delete_bitmap, write_strbuf, sb); -ewah_serialize_to (si->replace_bitmap, write_strbuf, sb); +ewah_serialize_strbuf (si->delete_bitmap, sb); +ewah_serialize_strbuf (si->replace_bitmap, sb);return 0 ; }
test-dump-untracked-cache.c +1 -0
@@ -44,6 +44,7 @@ int main(int ac, char **av) {struct untracked_cache *uc;struct strbuf base =STRBUF_INIT ; +setup_git_directory ();if (read_cache () <0 )die ("unable to read index file" ); uc = the_index.untracked;
-- 8< --
Signature · 1 line
2.2.0.60.gb7b3c64