summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authorChristian Couder <christian.couder@gmail.com>2016-01-24 15:28:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-01-25 20:39:58 (GMT)
commit4a4ca4796df6b81d5995f31e87e9e6a64c2b889d (patch)
tree620436b6f18601b0ef64f273f62892b21c431f07 /dir.c
parente7c0c5354be01bedb4c6f0ad3b095ff0bfefa272 (diff)
downloadgit-4a4ca4796df6b81d5995f31e87e9e6a64c2b889d.zip
git-4a4ca4796df6b81d5995f31e87e9e6a64c2b889d.tar.gz
git-4a4ca4796df6b81d5995f31e87e9e6a64c2b889d.tar.bz2
dir: add {new,add}_untracked_cache()
Factor out code into new_untracked_cache() and add_untracked_cache(), which will be used in later commits. Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/dir.c b/dir.c
index d2a8f06..31eae37 100644
--- a/dir.c
+++ b/dir.c
@@ -1938,6 +1938,24 @@ void add_untracked_ident(struct untracked_cache *uc)
strbuf_addch(&uc->ident, 0);
}
+static void new_untracked_cache(struct index_state *istate)
+{
+ struct untracked_cache *uc = xcalloc(1, sizeof(*uc));
+ strbuf_init(&uc->ident, 100);
+ uc->exclude_per_dir = ".gitignore";
+ /* should be the same flags used by git-status */
+ uc->dir_flags = DIR_SHOW_OTHER_DIRECTORIES | DIR_HIDE_EMPTY_DIRECTORIES;
+ istate->untracked = uc;
+}
+
+void add_untracked_cache(struct index_state *istate)
+{
+ if (!istate->untracked) {
+ new_untracked_cache(istate);
+ add_untracked_ident(istate->untracked);
+ istate->cache_changed |= UNTRACKED_CHANGED;
+}
+
static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *dir,
int base_len,
const struct pathspec *pathspec)