diff options
author | Patrick Steinhardt <ps@pks.im> | 2016-11-14 09:38:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-14 09:38:44 +0100 |
commit | 2d2055164274bd6cc12047c7f2d07f51e118f5ff (patch) | |
tree | aafda08021e1343074171f6315c38581c36a17d1 | |
parent | 19981467ea416406503332539b7b97f0366247df (diff) | |
parent | c9e967a1b48c7a0b484fd3a4860e9c7a0aa4a319 (diff) | |
download | libgit2-2d2055164274bd6cc12047c7f2d07f51e118f5ff.tar.gz |
Merge pull request #3992 from joshtriplett/env-namespace
git_repository_open_ext: fix handling of $GIT_NAMESPACE
-rw-r--r-- | src/repository.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/repository.c b/src/repository.c index cf3d18a2d..7bdcefd40 100644 --- a/src/repository.c +++ b/src/repository.c @@ -613,9 +613,10 @@ static int _git_repository_open_ext_from_env( git_repository_set_odb(repo, odb); error = git__getenv(&alts_buf, "GIT_ALTERNATE_OBJECT_DIRECTORIES"); - if (error == GIT_ENOTFOUND) + if (error == GIT_ENOTFOUND) { giterr_clear(); - else if (error < 0) + error = 0; + } else if (error < 0) goto error; else { const char *end; @@ -638,9 +639,11 @@ static int _git_repository_open_ext_from_env( } } - error = git_repository_set_namespace(repo, git_buf_cstr(&namespace_buf)); - if (error < 0) - goto error; + if (git_buf_len(&namespace_buf)) { + error = git_repository_set_namespace(repo, git_buf_cstr(&namespace_buf)); + if (error < 0) + goto error; + } git_repository_set_index(repo, index); |