summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ee425e4)
raw | patch | inline | side by side (parent: ee425e4)
author | Junio C Hamano <gitster@pobox.com> | |
Sun, 18 Nov 2007 09:12:04 +0000 (01:12 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 23 Nov 2007 01:05:05 +0000 (17:05 -0800) |
This separates the logic to limit the extent of change to the
index by where you are (controlled by "prefix") and what you
specify from the command line (controlled by "pathspec").
Signed-off-by: Junio C Hamano <gitster@pobox.com>
index by where you are (controlled by "prefix") and what you
specify from the command line (controlled by "pathspec").
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-add.c | patch | blob | history | |
cache.h | patch | blob | history | |
commit.h | patch | blob | history |
diff --git a/builtin-add.c b/builtin-add.c
index cf815a0b8ef0e588cfaf25f71747ba7248d19d70..03508d3dcb18d161f799001067d5caf3e54fa160 100644 (file)
--- a/builtin-add.c
+++ b/builtin-add.c
}
}
-void add_files_to_cache(int verbose, const char *prefix, const char **files)
+void add_files_to_cache(int verbose, const char *prefix, const char **pathspec)
{
struct rev_info rev;
init_revisions(&rev, prefix);
setup_revisions(0, NULL, &rev, NULL);
- rev.prune_data = get_pathspec(prefix, files);
+ rev.prune_data = pathspec;
rev.diffopt.output_format = DIFF_FORMAT_CALLBACK;
rev.diffopt.format_callback = update_callback;
rev.diffopt.format_callback_data = &verbose;
newfd = hold_locked_index(&lock_file, 1);
if (take_worktree_changes) {
+ const char **pathspec;
if (read_cache() < 0)
die("index file corrupt");
- add_files_to_cache(verbose, prefix, argv);
+ pathspec = get_pathspec(prefix, argv);
+ add_files_to_cache(verbose, prefix, pathspec);
goto finish;
}
index 26eec229eb229ecec721350ac59666120ea21992..cf0bdc674cc81f0443be3776b01969e8e07d2025 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -604,13 +604,15 @@ extern void trace_argv_printf(const char **argv, int count, const char *format,
extern int convert_to_git(const char *path, const char *src, size_t len, struct strbuf *dst);
extern int convert_to_working_tree(const char *path, const char *src, size_t len, struct strbuf *dst);
+/* add */
+void add_files_to_cache(int verbose, const char *prefix, const char **pathspec);
+
/* diff.c */
extern int diff_auto_refresh_index;
/* match-trees.c */
void shift_tree(const unsigned char *, const unsigned char *, unsigned char *, int);
-
/* ls-files */
int pathspec_match(const char **spec, char *matched, const char *filename, int skiplen);
int report_path_error(const char *ps_matched, const char **pathspec, int prefix_offset);
diff --git a/commit.h b/commit.h
index aa679867a9376496febd5105121b1f49f3ff96a4..f450aae8aa38cfc96bce8a55e418a090c44c216d 100644 (file)
--- a/commit.h
+++ b/commit.h
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);
static inline int single_parent(struct commit *commit)