Re: [PATCH 4/8] Add a function to set a non-default work tree

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

 



Daniel Barkalow <barkalow@xxxxxxxxxxxx> writes:

> Signed-off-by: Daniel Barkalow <barkalow@xxxxxxxxxxxx>
> ---
>  cache.h       |    1 +
>  environment.c |    6 ++++++
>  2 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/cache.h b/cache.h
> index 96dcb49..d88a4e2 100644
> --- a/cache.h
> +++ b/cache.h
> @@ -311,6 +311,7 @@ extern char *get_index_file(void);
>  extern char *get_graft_file(void);
>  extern int set_git_dir(const char *path);
>  extern const char *get_git_work_tree(void);
> +extern void set_git_work_tree(const char *tree);
>  
>  #define ALTERNATE_DB_ENVIRONMENT "GIT_ALTERNATE_OBJECT_DIRECTORIES"
>  
> diff --git a/environment.c b/environment.c
> index 6739a3f..d6c6a6b 100644
> --- a/environment.c
> +++ b/environment.c
> @@ -81,6 +81,12 @@ const char *get_git_dir(void)
>  	return git_dir;
>  }
>  
> +void set_git_work_tree(const char *new_work_tree)
> +{
> +	get_git_work_tree(); /* make sure it's initialized */
> +	work_tree = xstrdup(make_absolute_path(new_work_tree));
> +}
> +

Somehow this feels wrong.  Maybe you would need to move that "static int"
variable inside get_git_work_tree() outside so that you can reset from
this new function at will?

How should the setting of new work tree from sideways using this interface
interact with bareness of the repository?

Should it reset is_bare_repository_cfg to zero?  Should it refuse to set a
work tree if is_bare_repository_cfg is true already?

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

  Powered by Linux