summaryrefslogtreecommitdiff
path: root/submodule.h
diff options
context:
space:
mode:
authorJens Lehmann <Jens.Lehmann@web.de>2012-09-01 17:27:06 +0200
committerJunio C Hamano <gitster@pobox.com>2012-09-02 21:13:50 -0700
commit50d89ad6542c8acafefa6d42f8b42dfa9b8fafe1 (patch)
tree15fdf8cce305fb0f82deb78c820f34c341a732f1 /submodule.h
parent85556d4e37db4c8ed88c68a602f6f85054996bea (diff)
downloadgit-50d89ad6542c8acafefa6d42f8b42dfa9b8fafe1.tar.gz
submodule: use argv_array instead of hand-building arrays
fetch_populated_submodules() allocates the full argv array it uses to recurse into the submodules from the number of given options plus the six argv values it is going to add. It then initializes it with those values which won't change during the iteration and copies the given options into it. Inside the loop the two argv values different for each submodule get replaced with those currently valid. However, this technique is brittle and error-prone (as the comment to explain the magic number 6 indicates), so let's replace it with an argv_array. Instead of replacing the argv values, push them to the argv_array just before the run_command() call (including the option separating them) and pop them from the argv_array right after that. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.h')
-rw-r--r--submodule.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/submodule.h b/submodule.h
index e105b0ebe6..594b50d510 100644
--- a/submodule.h
+++ b/submodule.h
@@ -2,6 +2,7 @@
#define SUBMODULE_H
struct diff_options;
+struct argv_array;
enum {
RECURSE_SUBMODULES_ON_DEMAND = -1,
@@ -23,7 +24,7 @@ void show_submodule_summary(FILE *f, const char *path,
const char *del, const char *add, const char *reset);
void set_config_fetch_recurse_submodules(int value);
void check_for_new_submodule_commits(unsigned char new_sha1[20]);
-int fetch_populated_submodules(int num_options, const char **options,
+int fetch_populated_submodules(const struct argv_array *options,
const char *prefix, int command_line_option,
int quiet);
unsigned is_submodule_modified(const char *path, int ignore_untracked);