[PATCH 2/4] This exports the update() function from builtin-add.c as

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <gitster@...>
Cc: <git@...>, Kristian Høgsberg <krh@...>
Date: Thursday, September 27, 2007 - 12:50 am

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
---
 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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 1/4] Add a simple option parser for use by builtin-co..., Kristian Høgsberg, (Thu Sep 27, 12:50 am)
Re: [PATCH 1/4] Add a simple option parser for use by builti..., Johannes Schindelin, (Mon Oct 1, 2:13 pm)
Re: [PATCH 1/4] Add a simple option parser for use by builti..., Johannes Schindelin, (Mon Oct 1, 6:14 am)
Re: [PATCH 1/4] Add a simple option parser for use by builti..., Johannes Schindelin, (Mon Oct 1, 7:39 am)
[PATCH 2/4] This exports the update() function from builtin-..., Kristian Høgsberg, (Thu Sep 27, 12:50 am)
Re: [PATCH 2/4] This exports the update() function from buil..., Johannes Schindelin, (Thu Sep 27, 7:47 am)
[PATCH 3/4] Implement git commit as a builtin command., Kristian Høgsberg, (Thu Sep 27, 12:50 am)