Re: [PATCH] fetch: Get submodule paths from index and not from .gitmodules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Unfortunately, the only effect this had was to change the order of fetches (it now appears to be case-sensitive alphabetical). After applying this patch, this is what I saw (using the same terms as my previous email):

Fetching submodule G
Fetching submodule B
Fetching submodule F
Fetching submodule C
Fetching submodule H
Fetching submodule E
Fetching submodule A
Fetching submodule D

Note that it's still telling me that it's fetching submodule H even though this inside of submodule C rather than at the root level. I also verified this by running `git ls-tree -r HEAD | grep commit` and observed that only submodules A-G show up in that list.

-Kevin Ballard

On Sep 16, 2010, at 6:55 AM, Jens Lehmann wrote:

> In the first version the .gitmodules file was parsed and all submodules
> found there were recursively fetched. This lead to problems when the
> .gitmodules file was not properly set up. "git submodule update" gets
> this information from the index via "git ls-files", lets do the same here.
> 
> Reported-by: Kevin Ballard <kevin@xxxxxx>
> Signed-off-by: Jens Lehmann <Jens.Lehmann@xxxxxx>
> ---
> 
> Could it be that the information in your .gitmodules files is not
> quite right? Then this patch should fix your problems with the
> recursion. Please test it and let me know if the submodules are
> now recursively fetched as they should.
> 
> 
> submodule.c |   25 +++++++++++++++++++------
> 1 files changed, 19 insertions(+), 6 deletions(-)
> 
> diff --git a/submodule.c b/submodule.c
> index 05661e2..13a694b 100644
> --- a/submodule.c
> +++ b/submodule.c
> @@ -240,7 +240,7 @@ void show_submodule_summary(FILE *f, const char *path,
> 
> int fetch_populated_submodules(int forced)
> {
> -	int result = 0;
> +	int i, result = 0;
> 	struct child_process cp;
> 	const char *argv[] = {
> 		"fetch",
> @@ -251,6 +251,10 @@ int fetch_populated_submodules(int forced)
> 	if (!work_tree)
> 		return 0;
> 
> +	if (!the_index.initialized)
> +		if (read_cache() < 0)
> +			die("index file corrupt");
> +
> 	memset(&cp, 0, sizeof(cp));
> 	cp.argv = argv;
> 	cp.env = local_repo_env;
> @@ -258,25 +262,34 @@ int fetch_populated_submodules(int forced)
> 	cp.no_stdin = 1;
> 	cp.out = -1;
> 
> -	for_each_string_list_item(name_for_path, &config_name_for_path) {
> +	for (i = 0; i < active_nr; i++) {
> 		struct strbuf submodule_path = STRBUF_INIT;
> 		struct strbuf submodule_git_dir = STRBUF_INIT;
> -		const char *git_dir;
> +		struct cache_entry *ce = active_cache[i];
> +		const char *git_dir, *name;
> +
> +		if (!S_ISGITLINK(ce->ce_mode))
> +			continue;
> +
> +		name = ce->name;
> +		name_for_path = unsorted_string_list_lookup(&config_name_for_path, ce->name);
> +		if (name_for_path)
> +			name = name_for_path->util;
> 
> 		if (!forced) {
> 			struct string_list_item *fetch_option;
> -			fetch_option = unsorted_string_list_lookup(&config_fetch_for_name, name_for_path->util);
> +			fetch_option = unsorted_string_list_lookup(&config_fetch_for_name, name);
> 			if (fetch_option && !fetch_option->util)
> 				continue;
> 		}
> 
> -		strbuf_addf(&submodule_path, "%s/%s", work_tree, name_for_path->string);
> +		strbuf_addf(&submodule_path, "%s/%s", work_tree, ce->name);
> 		strbuf_addf(&submodule_git_dir, "%s/.git", submodule_path.buf);
> 		git_dir = read_gitfile_gently(submodule_git_dir.buf);
> 		if (!git_dir)
> 			git_dir = submodule_git_dir.buf;
> 		if (is_directory(git_dir)) {
> -			printf("Fetching submodule %s\n", name_for_path->string);
> +			printf("Fetching submodule %s\n", ce->name);
> 			cp.dir = submodule_path.buf;
> 			if (run_command(&cp))
> 				result = 1;
> -- 
> 1.7.3.rc2.232.g3328

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]