Commit 9cd0c6f1f1b8dc5fbb5957e1ff3291953b14379e

Carlos Martín Nieto 2018-02-28T16:01:16

config: return an error if config_refresh is called on a snapshot Instead of treating it as a no-op, treat it as a programming error and return the same kind of error as if you called to set or delete variables on a snapshot.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/config_file.c b/src/config_file.c
index a594e51..aa9e83b 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -327,7 +327,7 @@ static int config_refresh(git_config_backend *cfg)
 	uint32_t i;
 
 	if (b->header.parent.readonly)
-		return 0;
+		return config_error_readonly();
 
 	error = config_is_modified(&modified, &b->file);
 	if (error < 0 && error != GIT_ENOTFOUND)