Re: [GSoC RFC PATCH 4/5] repo-info: add field layout.bare

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

 



Lucas Seiki Oshiro <lucasseikioshiro@xxxxxxxxx> writes:

>>> +#define USE_THE_REPOSITORY_VARIABLE
>>> 
>> Ah! Seems like `is_bare_repository()` is responsible for this, it would
>> be nice to not introduce global dependency in a new command, but this
>> isn't part of your project, so it's okay here.
>
> Yeah, to be honest I was reluctant to use this, and I tried to find if
> I could easily drop this dependency. But this is `is_bare_repository`:
>
> int is_bare_repository(void)
> {
> 	/* if core.bare is not 'false', let's see if there is a work tree */
> 	return is_bare_repository_cfg && !repo_get_work_tree(the_repository);
> }
>
> But I couldn't find out what is the dependency of is_bare_repository_cfg
> on the_repository yet, but I decided to keep for this RFC.

I suspect that by the time setup_git_env() is called in the startup
sequence from setup_git_directory(), we know that the repository
knows if the repository is bare.  So one thing we could do is to add
is-bare-repository-cfg bit as a new member to the repo-settings
object of the_repository and record the bit before the
setup_git_directory() callchain returns.

Then you can teach is_bare_repository() to take a repo object from
its caller and the above may become something like

	int repository_is_bare(struct repository *r)
	{
		return (r->settings.is_bare_repository &&
			!repo_get_work_tree(r));
	}

perhaps.




[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