Skip to content

Commit 1bbb3db

Browse files
pcloudsgitster
authored andcommitted
untracked cache: mark index dirty if untracked cache is updated
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c9ccb5d commit 1bbb3db

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

cache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ static inline unsigned int canon_mode(unsigned int mode)
289289
#define RESOLVE_UNDO_CHANGED (1 << 4)
290290
#define CACHE_TREE_CHANGED (1 << 5)
291291
#define SPLIT_INDEX_ORDERED (1 << 6)
292+
#define UNTRACKED_CHANGED (1 << 7)
292293

293294
struct split_index;
294295
struct untracked_cache;

dir.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1934,6 +1934,15 @@ int read_directory(struct dir_struct *dir, const char *path, int len, const stru
19341934
dir->untracked->gitignore_invalidated,
19351935
dir->untracked->dir_invalidated,
19361936
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+
}
19371946
}
19381947
return dir->nr;
19391948
}

read-cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static struct cache_entry *refresh_cache_entry(struct cache_entry *ce,
4444
/* changes that can be kept in $GIT_DIR/index (basically all extensions) */
4545
#define EXTMASK (RESOLVE_UNDO_CHANGED | CACHE_TREE_CHANGED | \
4646
CE_ENTRY_ADDED | CE_ENTRY_REMOVED | CE_ENTRY_CHANGED | \
47-
SPLIT_INDEX_ORDERED)
47+
SPLIT_INDEX_ORDERED | UNTRACKED_CHANGED)
4848

4949
struct index_state the_index;
5050
static const char *alternate_index_output;

0 commit comments

Comments
 (0)