Re: [PATCH v3 06/10] submodule update: add `--init-active` switch

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

 



Brandon Williams <bmwill@xxxxxxxxxx> writes:

> +static void module_list_active(struct module_list *list)
> +{
> +	int i;
> +
> +	if (read_cache() < 0)
> +		die(_("index file corrupt"));
> +
> +	gitmodules_config();
> +
> +	for (i = 0; i < active_nr; i++) {
> +		const struct cache_entry *ce = active_cache[i];
> +
> +		if (!S_ISGITLINK(ce->ce_mode) ||
> +		    !is_submodule_initialized(ce->name))
> +			continue;

This, because "is_submodule_initialized()" is not "is it
initialized?" but "is it interesting?", will catch a submodule
that used to be uninteresting but has become interesting (e.g. a new
submodule added to somewhere in "lib/" when submodule.active lists
"lib/" as one of the pathspecs to match interesting submodules) and
automatically updates it.

I anticipate that a corresponding "please deinitialize ones that are
no longer interesting" coming in the series ;-)  Without it, the
interested set will only grow without shrinking.

> +		ALLOC_GROW(list->entries, list->nr + 1, list->alloc);
> +		list->entries[list->nr++] = ce;
> +		while (i + 1 < active_nr &&
> +		       !strcmp(ce->name, active_cache[i + 1]->name))
> +			/*
> +			 * Skip entries with the same name in different stages
> +			 * to make sure an entry is returned only once.
> +			 */
> +			i++;
> +	}
> +}



[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]