path: root/repository.h
diff options
authorNguyễn Thái Ngọc Duy <>2018-03-03 11:35:55 (GMT)
committerJunio C Hamano <>2018-03-05 19:14:03 (GMT)
commit357a03ebe9e04329705a46ff36d526c5ab0c3ebc (patch)
treec95809c925390ceae12fa925af722576c5675afe /repository.h
parentb2f0eceecf266e60fa95970e0973a8f23f911fb1 (diff)
repository.c: move env-related setup code back to environment.c
It does not make sense that generic repository code contains handling of environment variables, which are specific for the main repository only. Refactor repo_set_gitdir() function to take $GIT_DIR and optionally _all_ other customizable paths. These optional paths can be NULL and will be calculated according to the default directory layout. Note that some dead functions are left behind to reduce diff noise. They will be deleted in the next patch. Signed-off-by: Nguyễn Thái Ngọc Duy <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'repository.h')
1 files changed, 10 insertions, 1 deletions
diff --git a/repository.h b/repository.h
index 40c1c81..84aeac2 100644
--- a/repository.h
+++ b/repository.h
@@ -88,7 +88,16 @@ struct repository {
extern struct repository *the_repository;
-extern void repo_set_gitdir(struct repository *repo, const char *path);
+struct set_gitdir_args {
+ const char *commondir;
+ const char *object_dir;
+ const char *graft_file;
+ const char *index_file;
+extern void repo_set_gitdir(struct repository *repo,
+ const char *root,
+ const struct set_gitdir_args *optional);
extern void repo_set_worktree(struct repository *repo, const char *path);
extern void repo_set_hash_algo(struct repository *repo, int algo);
extern void initialize_the_repository(void);