built-in add -i: refresh the index before running status

This is what the Perl version does, and therefore it is what the
built-in version should do, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2019-03-27 23:46:46 +01:00
parent 1df97d2fa1
commit 464b7ce46a
3 changed files with 29 additions and 1 deletions

View File

@@ -258,7 +258,9 @@ int run_add_i(struct repository *r, const struct pathspec *ps)
_("staged"), _("unstaged"), _("path"));
opts.header = header.buf;
res = run_status(r, ps, &files, &opts);
repo_refresh_and_write_index(r, REFRESH_QUIET, 1);
if (run_status(r, ps, &files, &opts) < 0)
res = -1;
release_file_list(&files);
strbuf_release(&print_file_item_data.buf);