summaryrefslogtreecommitdiff
path: root/add-interactive.c
diff options
context:
space:
mode:
Diffstat (limited to 'add-interactive.c')
-rw-r--r--add-interactive.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/add-interactive.c b/add-interactive.c
index ecc5ae1b24..de877ca052 100644
--- a/add-interactive.c
+++ b/add-interactive.c
@@ -3,6 +3,8 @@
#include "color.h"
#include "config.h"
#include "diffcore.h"
+#include "gettext.h"
+#include "hex.h"
#include "revision.h"
#include "refs.h"
#include "string-list.h"
@@ -10,6 +12,7 @@
#include "dir.h"
#include "run-command.h"
#include "prompt.h"
+#include "tree.h"
static void init_color(struct repository *r, struct add_i_state *s,
const char *section_and_slot, char *dst,
@@ -530,8 +533,8 @@ static int get_modified_files(struct repository *r,
struct collection_status s = { 0 };
int i;
- if (discard_index(r->index) < 0 ||
- repo_read_index_preload(r, ps, 0) < 0)
+ discard_index(r->index);
+ if (repo_read_index_preload(r, ps, 0) < 0)
return error(_("could not read index"));
prefix_item_list_clear(files);
@@ -551,7 +554,7 @@ static int get_modified_files(struct repository *r,
opt.def = is_initial ?
empty_tree_oid_hex() : oid_to_hex(&head_oid);
- init_revisions(&rev, NULL);
+ repo_init_revisions(r, &rev, NULL);
setup_revisions(0, NULL, &rev, &opt);
rev.diffopt.output_format = DIFF_FORMAT_CALLBACK;
@@ -724,7 +727,7 @@ static int run_update(struct add_i_state *s, const struct pathspec *ps,
}
static void revert_from_diff(struct diff_queue_struct *q,
- struct diff_options *opt, void *data)
+ struct diff_options *opt, void *data UNUSED)
{
int i, add_flags = ADD_CACHE_OK_TO_ADD | ADD_CACHE_OK_TO_REPLACE;
@@ -1156,8 +1159,8 @@ int run_add_i(struct repository *r, const struct pathspec *ps)
_("staged"), _("unstaged"), _("path"));
opts.list_opts.header = header.buf;
- if (discard_index(r->index) < 0 ||
- repo_read_index(r) < 0 ||
+ discard_index(r->index);
+ if (repo_read_index(r) < 0 ||
repo_refresh_and_write_index(r, REFRESH_QUIET, 0, 1,
NULL, NULL, NULL) < 0)
warning(_("could not refresh index"));