status: enable untracked cache

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>

Nguyễn Thái Ngọc Duy committed Mar 8, 2015 at 17:12 UTC 226c051adb0f64772f807287e130a6a546b95fbd
2 files changed +5 -2
builtin/commit.c
+3 -2
@@ -1364,13 +1364,14 @@ int cmd_status(int argc, const char **argv, const char *prefix)
1364 refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, &s.pathspec, NULL, NULL);
1365
1366 fd = hold_locked_index(&index_lock, 0);
1367 - if (0 <= fd)
1368 - update_index_if_able(&the_index, &index_lock);
1367
1368 s.is_initial = get_sha1(s.reference, sha1) ? 1 : 0;
1369 s.ignore_submodule_arg = ignore_submodule_arg;
1370 wt_status_collect(&s);
1371
1372 + if (0 <= fd)
1373 + update_index_if_able(&the_index, &index_lock);
1374 +
1375 if (s.relative_paths)
1376 s.prefix = prefix;
1377
wt-status.c
+2
@@ -585,6 +585,8 @@ static void wt_status_collect_untracked(struct wt_status *s)
585 DIR_SHOW_OTHER_DIRECTORIES | DIR_HIDE_EMPTY_DIRECTORIES;
586 if (s->show_ignored_files)
587 dir.flags |= DIR_SHOW_IGNORED_TOO;
588 + else
589 + dir.untracked = the_index.untracked;
590 setup_standard_excludes(&dir);
591
592 fill_directory(&dir, &s->pathspec);