[PATCH 16/24] untracked cache: mark index dirty if untracked cache is updated

2015-03-08 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com
Signed-off-by: Junio C Hamano gits...@pobox.com
---
 cache.h  | 1 +
 dir.c| 9 +
 read-cache.c | 2 +-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/cache.h b/cache.h
index f8b3dc5..fca979b 100644
--- a/cache.h
+++ b/cache.h
@@ -295,6 +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)
 
 struct split_index;
 struct untracked_cache;
diff --git a/dir.c b/dir.c
index 01f0032..1b98663 100644
--- a/dir.c
+++ b/dir.c
@@ -1934,6 +1934,15 @@ int read_directory(struct dir_struct *dir, const char 
*path, int len, const stru
 dir-untracked-gitignore_invalidated,
 dir-untracked-dir_invalidated,
 dir-untracked-dir_opened);
+   if (dir-untracked == the_index.untracked 
+   (dir-untracked-dir_opened ||
+dir-untracked-gitignore_invalidated ||
+dir-untracked-dir_invalidated))
+   the_index.cache_changed |= UNTRACKED_CHANGED;
+   if (dir-untracked != the_index.untracked) {
+   free(dir-untracked);
+   dir-untracked = NULL;
+   }
}
return dir-nr;
 }
diff --git a/read-cache.c b/read-cache.c
index 0ecba05..71d8e20 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -42,7 +42,7 @@ static struct cache_entry *refresh_cache_entry(struct 
cache_entry *ce,
 /* changes that can be kept in $GIT_DIR/index (basically all extensions) */
 #define EXTMASK (RESOLVE_UNDO_CHANGED | CACHE_TREE_CHANGED | \
 CE_ENTRY_ADDED | CE_ENTRY_REMOVED | CE_ENTRY_CHANGED | \
-SPLIT_INDEX_ORDERED)
+SPLIT_INDEX_ORDERED | UNTRACKED_CHANGED)
 
 struct index_state the_index;
 static const char *alternate_index_output;
-- 
2.3.0.rc1.137.g477eb31

--
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


[PATCH 16/24] untracked cache: mark index dirty if untracked cache is updated

2015-02-08 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com
Signed-off-by: Junio C Hamano gits...@pobox.com
---
 cache.h  | 1 +
 dir.c| 9 +
 read-cache.c | 2 +-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/cache.h b/cache.h
index f8b3dc5..fca979b 100644
--- a/cache.h
+++ b/cache.h
@@ -295,6 +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)
 
 struct split_index;
 struct untracked_cache;
diff --git a/dir.c b/dir.c
index c5ca5ce..1c3db0b 100644
--- a/dir.c
+++ b/dir.c
@@ -1933,6 +1933,15 @@ int read_directory(struct dir_struct *dir, const char 
*path, int len, const stru
 dir-untracked-gitignore_invalidated,
 dir-untracked-dir_invalidated,
 dir-untracked-dir_opened);
+   if (dir-untracked == the_index.untracked 
+   (dir-untracked-dir_opened ||
+dir-untracked-gitignore_invalidated ||
+dir-untracked-dir_invalidated))
+   the_index.cache_changed |= UNTRACKED_CHANGED;
+   if (dir-untracked != the_index.untracked) {
+   free(dir-untracked);
+   dir-untracked = NULL;
+   }
}
return dir-nr;
 }
diff --git a/read-cache.c b/read-cache.c
index 0ecba05..71d8e20 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -42,7 +42,7 @@ static struct cache_entry *refresh_cache_entry(struct 
cache_entry *ce,
 /* changes that can be kept in $GIT_DIR/index (basically all extensions) */
 #define EXTMASK (RESOLVE_UNDO_CHANGED | CACHE_TREE_CHANGED | \
 CE_ENTRY_ADDED | CE_ENTRY_REMOVED | CE_ENTRY_CHANGED | \
-SPLIT_INDEX_ORDERED)
+SPLIT_INDEX_ORDERED | UNTRACKED_CHANGED)
 
 struct index_state the_index;
 static const char *alternate_index_output;
-- 
2.3.0.rc1.137.g477eb31

--
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


[PATCH 16/24] untracked cache: mark index dirty if untracked cache is updated

2015-01-20 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com
Signed-off-by: Junio C Hamano gits...@pobox.com
---
 cache.h  | 1 +
 dir.c| 9 +
 read-cache.c | 2 +-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/cache.h b/cache.h
index f8b3dc5..fca979b 100644
--- a/cache.h
+++ b/cache.h
@@ -295,6 +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)
 
 struct split_index;
 struct untracked_cache;
diff --git a/dir.c b/dir.c
index c5ca5ce..1c3db0b 100644
--- a/dir.c
+++ b/dir.c
@@ -1933,6 +1933,15 @@ int read_directory(struct dir_struct *dir, const char 
*path, int len, const stru
 dir-untracked-gitignore_invalidated,
 dir-untracked-dir_invalidated,
 dir-untracked-dir_opened);
+   if (dir-untracked == the_index.untracked 
+   (dir-untracked-dir_opened ||
+dir-untracked-gitignore_invalidated ||
+dir-untracked-dir_invalidated))
+   the_index.cache_changed |= UNTRACKED_CHANGED;
+   if (dir-untracked != the_index.untracked) {
+   free(dir-untracked);
+   dir-untracked = NULL;
+   }
}
return dir-nr;
 }
diff --git a/read-cache.c b/read-cache.c
index 0ecba05..71d8e20 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -42,7 +42,7 @@ static struct cache_entry *refresh_cache_entry(struct 
cache_entry *ce,
 /* changes that can be kept in $GIT_DIR/index (basically all extensions) */
 #define EXTMASK (RESOLVE_UNDO_CHANGED | CACHE_TREE_CHANGED | \
 CE_ENTRY_ADDED | CE_ENTRY_REMOVED | CE_ENTRY_CHANGED | \
-SPLIT_INDEX_ORDERED)
+SPLIT_INDEX_ORDERED | UNTRACKED_CHANGED)
 
 struct index_state the_index;
 static const char *alternate_index_output;
-- 
2.2.0.84.ge9c7a8a

--
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