summaryrefslogtreecommitdiff
path: root/builtin/update-index.c
diff options
context:
space:
mode:
authorChristian Couder <christian.couder@gmail.com>2016-01-24 16:28:19 +0100
committerJunio C Hamano <gitster@pobox.com>2016-01-25 12:39:58 -0800
commit4a4ca4796df6b81d5995f31e87e9e6a64c2b889d (patch)
tree620436b6f18601b0ef64f273f62892b21c431f07 /builtin/update-index.c
parente7c0c5354be01bedb4c6f0ad3b095ff0bfefa272 (diff)
downloadgit-4a4ca4796df6b81d5995f31e87e9e6a64c2b889d.tar.gz
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 'builtin/update-index.c')
-rw-r--r--builtin/update-index.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/builtin/update-index.c b/builtin/update-index.c
index fe7aaa34a4..5f8630c61b 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -1123,16 +1123,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
if (untracked_cache == UC_TEST)
return 0;
}
- if (!the_index.untracked) {
- 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;
- the_index.untracked = uc;
- }
- add_untracked_ident(the_index.untracked);
- the_index.cache_changed |= UNTRACKED_CHANGED;
+ add_untracked_cache(&the_index);
report(_("Untracked cache enabled for '%s'"), get_git_work_tree());
} else if (untracked_cache == UC_DISABLE) {
if (the_index.untracked) {