Commit 18a6d9f3a82d2363ed45713a47f48ac8f383bb41

Sven Strickroth 2019-06-29T16:19:08

attr: Don't fail in attr_setup if there exists a system attributes file Regression introduced in commit 5452e49fce21f726bec19519da7f012e3f19e736 on PR #4967. Signed-off-by: Sven Strickroth <email@cs-ware.de>

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/src/attr.c b/src/attr.c
index f50d28c..877bc87 100644
--- a/src/attr.c
+++ b/src/attr.c
@@ -333,6 +333,7 @@ static int attr_setup(git_repository *repo, git_attr_session *attr_session)
 				       NULL, git_repository_attr_cache(repo)->cfg_attr_file)) < 0)
 		goto out;
 
+	git_buf_clear(&path); /* git_repository_item_path expects an empty buffer, because it uses git_buf_set */
 	if ((error = git_repository_item_path(&path, repo, GIT_REPOSITORY_ITEM_INFO)) < 0 ||
 	    (error = preload_attr_file(repo, attr_session, GIT_ATTR_FILE__FROM_FILE,
 				       path.ptr, GIT_ATTR_FILE_INREPO)) < 0) {