Re: [PATCH 6/9] repository: repo_submodule_init to take a submodule struct

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

 



> When constructing a struct repository for a submodule for some revision
> of the superproject where the submodule is not contained in the index,
> it may not be present in the working tree currently either. In that
> siutation giving a 'path' argument is not useful. Upgrade the
> repo_submodule_init function to take a struct submodule instead.

Are there ways for other code to create a struct submodule without using
submodule_from_path()? If yes, maybe outline them here and say that this
makes repo_submodule_init() more useful, since it can now be used with
those methods.

> While we are at it, overhaul the repo_submodule_init function by renaming
> the submodule repository struct, which is to be initialized, to a name
> that is not confused with the struct submodule as easily.

"Overhaul" is probably not the right word for just a rename of a local
variable. Also mention the other functions in which you did this rename
(or just say "repo_submodule_init() and other functions").

> +/*
> + * Initialize the repository 'subrepo' as the submodule given by the
> + * struct submodule 'sub' in parent repository 'superproject'.
> + * Return 0 upon success and a non-zero value upon failure.
> + */
> +struct submodule;
> +int repo_submodule_init(struct repository *subrepo,
>  			struct repository *superproject,
> -			const char *path);
> +			const struct submodule *sub);

>From this description, I would expect "sub" to not be allowed to be
NULL, but from the code I don't think that's the case. Should we
prohibit NULL (and add checks to all repo_submodule_init()'s callers) or
document that a NULL sub is allowed (and what happens in that case)?



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

  Powered by Linux