summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2019-08-06 12:27:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-08-06 20:09:01 (GMT)
commit22932d9169fea7c826c85e2407054feff30ebaf1 (patch)
tree109017e88b8163070c2df39c001fbb7be0dd5385 /config.c
parent5732f2b1ef3559f2b2a5c67302f8bf21846488bc (diff)
downloadgit-22932d9169fea7c826c85e2407054feff30ebaf1.zip
git-22932d9169fea7c826c85e2407054feff30ebaf1.tar.gz
git-22932d9169fea7c826c85e2407054feff30ebaf1.tar.bz2
config: stop checking whether the_repository is NULL
Since the previous commit, our invariant that the_repository is never NULL is restored, and we can stop being defensive in include_by_branch(). We can confirm the fix by showing that an onbranch config include will not cause a segfault when run outside a git repository. I've put this in t1309-early-config since it's related to the case added by 85fe0e800c (config: work around bug with includeif:onbranch and early config, 2019-07-31), though technically the issue was with read_very_early_config() and not read_early_config(). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.c')
-rw-r--r--config.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/config.c b/config.c
index 3900e49..cc63736 100644
--- a/config.c
+++ b/config.c
@@ -275,7 +275,7 @@ static int include_by_branch(const char *cond, size_t cond_len)
int flags;
int ret;
struct strbuf pattern = STRBUF_INIT;
- const char *refname = !the_repository || !the_repository->gitdir ?
+ const char *refname = !the_repository->gitdir ?
NULL : resolve_ref_unsafe("HEAD", 0, NULL, &flags);
const char *shortname;