status: enable untracked cache
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Sun, 8 Mar 2015 10:12:41 +0000 (17:12 +0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 12 Mar 2015 20:45:17 +0000 (13:45 -0700)
update_index_if_able() is moved down so that the updated untracked
cache could be written out.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/commit.c
wt-status.c
index 961e467242747dac07aa6f5e619e2d1a50570b06..fe380a9b92cd7b4a301bfe0dba514319feda5832 100644 (file)
@@ -1364,13 +1364,14 @@ int cmd_status(int argc, const char **argv, const char *prefix)
        refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, &s.pathspec, NULL, NULL);
 
        fd = hold_locked_index(&index_lock, 0);
-       if (0 <= fd)
-               update_index_if_able(&the_index, &index_lock);
 
        s.is_initial = get_sha1(s.reference, sha1) ? 1 : 0;
        s.ignore_submodule_arg = ignore_submodule_arg;
        wt_status_collect(&s);
 
+       if (0 <= fd)
+               update_index_if_able(&the_index, &index_lock);
+
        if (s.relative_paths)
                s.prefix = prefix;
 
index 29666d0dbaa5af768aca86f3ca0b644ac9720648..fc1b82e2c188078e515f6cdcc298ac854b5223c3 100644 (file)
@@ -585,6 +585,8 @@ static void wt_status_collect_untracked(struct wt_status *s)
                        DIR_SHOW_OTHER_DIRECTORIES | DIR_HIDE_EMPTY_DIRECTORIES;
        if (s->show_ignored_files)
                dir.flags |= DIR_SHOW_IGNORED_TOO;
+       else
+               dir.untracked = the_index.untracked;
        setup_standard_excludes(&dir);
 
        fill_directory(&dir, &s->pathspec);