diff options
Diffstat (limited to 'repository.c')
-rw-r--r-- | repository.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/repository.c b/repository.c index 52f1821c6b..97c732bd48 100644 --- a/repository.c +++ b/repository.c @@ -56,16 +56,12 @@ static void repo_setup_env(struct repository *repo) void repo_set_gitdir(struct repository *repo, const char *path) { const char *gitfile = read_gitfile(path); + char *old_gitdir = repo->gitdir; - /* - * NEEDSWORK: Eventually we want to be able to free gitdir and the rest - * of the environment before reinitializing it again, but we have some - * crazy code paths where we try to set gitdir with the current gitdir - * and we don't want to free gitdir before copying the passed in value. - */ repo->gitdir = xstrdup(gitfile ? gitfile : path); - repo_setup_env(repo); + + free(old_gitdir); } /* |