Re: [PATCH v2 4/8] repository: add repo reference to index_state

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

 



"Derrick Stolee via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:

> From: Derrick Stolee <dstolee@xxxxxxxxxxxxx>
>
> It will be helpful to add behavior to index operations that might
> trigger an object lookup. Since each index belongs to a specific
> repository, add a 'repo' pointer to struct index_state that allows
> access to this repository.
>
> This will prevent future changes from needing to pass an additional
> 'struct repository *repo' parameter and instead rely only on the 'struct
> index_state *istate' parameter.
>
> Signed-off-by: Derrick Stolee <dstolee@xxxxxxxxxxxxx>
> ---

I think this makes sense, but shouldn't we insist on these
bidirectional links to point at each other?  Otherwise we cannot
simplify the function signatures safely later.  That is ...

> +	/* Complete the double-reference */
> +	if (!repo->index->repo)
> +		repo->index->repo = repo;
> +

	else if (repo->index->repo != repo)
		BUG("the repo->index instance does not belong to the repo???");

... a check like this?

>  	return read_index_from(repo->index, repo->index_file, repo->gitdir);
>  }



[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