untracked cache: mark index dirty if untracked cache is updated

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Mar 8, 2015 at 17:12 UTC 1bbb3dba3fbf733db45f073ddafe89f5972c516a
3 files changed +11 -1
cache.h
+1
@@ -289,6 +289,7 @@ static inline unsigned int canon_mode(unsigned int mode)
289 #define RESOLVE_UNDO_CHANGED (1 << 4)
290 #define CACHE_TREE_CHANGED (1 << 5)
291 #define SPLIT_INDEX_ORDERED (1 << 6)
292 +#define UNTRACKED_CHANGED (1 << 7)
293
294 struct split_index;
295 struct untracked_cache;
dir.c
+9
@@ -1934,6 +1934,15 @@ int read_directory(struct dir_struct *dir, const char *path, int len, const stru
1934 dir->untracked->gitignore_invalidated,
1935 dir->untracked->dir_invalidated,
1936 dir->untracked->dir_opened);
1937 + if (dir->untracked == the_index.untracked &&
1938 + (dir->untracked->dir_opened ||
1939 + dir->untracked->gitignore_invalidated ||
1940 + dir->untracked->dir_invalidated))
1941 + the_index.cache_changed |= UNTRACKED_CHANGED;
1942 + if (dir->untracked != the_index.untracked) {
1943 + free(dir->untracked);
1944 + dir->untracked = NULL;
1945 + }
1946 }
1947 return dir->nr;
1948 }
read-cache.c
+1 -1
@@ -44,7 +44,7 @@ static struct cache_entry *refresh_cache_entry(struct cache_entry *ce,
44 /* changes that can be kept in $GIT_DIR/index (basically all extensions) */
45 #define EXTMASK (RESOLVE_UNDO_CHANGED | CACHE_TREE_CHANGED | \
46 CE_ENTRY_ADDED | CE_ENTRY_REMOVED | CE_ENTRY_CHANGED | \
47 - SPLIT_INDEX_ORDERED)
47 + SPLIT_INDEX_ORDERED | UNTRACKED_CHANGED)
48
49 struct index_state the_index;
50 static const char *alternate_index_output;