[PATCH 2/4] This exports the update() function from builtin-add.c as
From: Kristian Høgsberg <hidden>
Date: 2016-06-15 22:43:36
Subsystem:
the rest · Maintainer:
Linus Torvalds
Signed-off-by: Kristian Høgsberg <redacted> --- builtin-add.c | 8 ++++---- commit.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/builtin-add.c b/builtin-add.c
index 5e30380..966e145 100644
--- a/builtin-add.c
+++ b/builtin-add.c@@ -107,7 +107,7 @@ static void update_callback(struct diff_queue_struct *q, } } -static void update(int verbose, const char *prefix, const char **files) +void add_files_to_cache(int verbose, const char *prefix, const char **files) { struct rev_info rev; init_revisions(&rev, prefix);
@@ -116,8 +116,6 @@ static void update(int verbose, const char *prefix, const char **files) rev.diffopt.output_format = DIFF_FORMAT_CALLBACK; rev.diffopt.format_callback = update_callback; rev.diffopt.format_callback_data = &verbose; - if (read_cache() < 0) - die("index file corrupt"); run_diff_files(&rev, 0); }
@@ -218,7 +216,9 @@ int cmd_add(int argc, const char **argv, const char *prefix) } if (take_worktree_changes) { - update(verbose, prefix, argv + i); + if (read_cache() < 0) + die("index file corrupt"); + add_files_to_cache(verbose, prefix, argv + i); goto finish; }
diff --git a/commit.h b/commit.h
index cc8d890..89caa12 100644
--- a/commit.h
+++ b/commit.h@@ -130,6 +130,8 @@ extern struct commit_list *get_shallow_commits(struct object_array *heads, int in_merge_bases(struct commit *, struct commit **, int); extern int interactive_add(void); +extern void add_files_to_cache(int verbose, + const char *prefix, const char **files); extern int rerere(void); #endif /* COMMIT_H */
--
1.5.2.GIT