Commit 8a349bf2a1e7257a4f35599b3613d7953289dc88

Etienne Samson 2016-12-26T14:47:55

ignore: there must be a repository Otherwise we'll NULL-dereference in git_attr_cache__init

diff --git a/src/ignore.c b/src/ignore.c
index d1a6c55..cc9e08e 100644
--- a/src/ignore.c
+++ b/src/ignore.c
@@ -278,7 +278,7 @@ int git_ignore__for_path(
 	int error = 0;
 	const char *workdir = git_repository_workdir(repo);
 
-	assert(ignores && path);
+	assert(repo && ignores && path);
 
 	memset(ignores, 0, sizeof(*ignores));
 	ignores->repo = repo;
@@ -503,9 +503,9 @@ int git_ignore_path_is_ignored(
 	unsigned int i;
 	git_attr_file *file;
 
-	assert(ignored && pathname);
+	assert(repo && ignored && pathname);
 
-	workdir = repo ? git_repository_workdir(repo) : NULL;
+	workdir = git_repository_workdir(repo);
 
 	memset(&path, 0, sizeof(path));
 	memset(&ignores, 0, sizeof(ignores));