git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/3] fixup for patch 2: actually check the return value

From
Matthieu Moy <matthieu.moy@imag.fr>
Date
Jul 16, 2014, 16:09 UTC
Message-ID
<1405526952-25019-2-git-send-email-Matthieu.Moy@imag.fr>
In-Reply-To
<1405526952-25019-1-git-send-email-Matthieu.Moy@imag.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
I won't fight for this, but I think it makes sense.
 t/t1308-config-set.sh |  4 ++--
 test-config.c         | 10 ++++++----
 2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/t/t1308-config-set.sh b/t/t1308-config-set.sh
index ea031bf..f0307b7 100755
--- a/t/t1308-config-set.sh
+++ b/t/t1308-config-set.sh
@@ -168,7 +168,7 @@ test_expect_success 'find value_list for a key from a configset' '
 '
 
 test_expect_success 'proper error on non-existant files' '
-	echo "Error reading configuration file non-existant-file." >expect &&
+	echo "Error (-1) reading configuration file non-existant-file." >expect &&
 	test_expect_code 2 test-config configset_get_value foo.bar non-existant-file 2>actual &&
 	test_cmp expect actual
 '
@@ -176,7 +176,7 @@ test_expect_success 'proper error on non-existant files' '
 test_expect_success 'proper error on non-accessible files' '
 	chmod -r .git/config &&
 	test_when_finished "chmod +r .git/config" &&
-	echo "Error reading configuration file .git/config." >expect &&
+	echo "Error (-1) reading configuration file .git/config." >expect &&
 	test_expect_code 2 test-config configset_get_value foo.bar .git/config 2>actual &&
 	test_cmp expect actual
 '
diff --git a/test-config.c b/test-config.c
index cad35f4..9dd1b22 100644
--- a/test-config.c
+++ b/test-config.c
@@ -86,8 +86,9 @@ int main(int argc, char **argv)
 		}
 	} else if (!strcmp(argv[1], "configset_get_value")) {
 		for (i = 3; i < argc; i++) {
-			if (git_configset_add_file(&cs, argv[i])) {
-				fprintf(stderr, "Error reading configuration file %s.\n", argv[i]);
+			int err;
+			if ((err = git_configset_add_file(&cs, argv[i]))) {
+				fprintf(stderr, "Error (%d) reading configuration file %s.\n", err, argv[i]);
 				goto exit2;
 			}
 		}
@@ -103,8 +104,9 @@ int main(int argc, char **argv)
 		}
 	} else if (!strcmp(argv[1], "configset_get_value_multi")) {
 		for (i = 3; i < argc; i++) {
-			if (git_configset_add_file(&cs, argv[i])) {
-				fprintf(stderr, "Error reading configuration file %s.\n", argv[i]);
+			int err;
+			if ((err = git_configset_add_file(&cs, argv[i]))) {
+				fprintf(stderr, "Error (%d) reading configuration file %s.\n", err, argv[i]);
 				goto exit2;
 			}
 		}
-- 
2.0.0.262.gdafc651
Previous: Matthieu MoyNext: Tanay Abhra
Message 15 of 26 in “git config cache & special querying api utilizing the cache”
  1. 0/3 git config cache & special querying api utilizing the cacheTanay Abhra, Jul 15, 2014
  2. 1/2 add `config_set` API for caching config-like filesTanay Abhra, Jul 15, 2014
  3. Junio C HamanoJul 15, 2014
  4. Tanay AbhraJul 15, 2014
  5. 1/2 add `config_set` API for caching config-like filesTanay Abhra, Jul 16, 2014
  6. 2/2 test-config: add tests for the config_set APITanay Abhra, Jul 15, 2014
  7. Junio C HamanoJul 15, 2014
  8. Tanay AbhraJul 15, 2014
  9. Junio C HamanoJul 15, 2014
  10. 2/2 test-config: add tests for the config_set APITanay Abhra, Jul 16, 2014
  11. Matthieu MoyJul 16, 2014
  12. 1/2 add `config_set` API for caching config-like filesTanay Abhra, Jul 16, 2014
  13. Matthieu MoyJul 16, 2014
  14. 1/3 fixup for patch 2: minor style fixMatthieu Moy, Jul 16, 2014
  15. 2/3 fixup for patch 2: actually check the return valueMatthieu Moy, Jul 16, 2014
  16. Tanay AbhraJul 16, 2014
  17. Matthieu MoyJul 16, 2014
  18. 3/3 fixup for patch 1: typoMatthieu Moy, Jul 16, 2014
  19. Tanay AbhraJul 16, 2014
  20. Matthieu MoyJul 16, 2014
  21. 2/2 test-config: add tests for the config_set APITanay Abhra, Jul 16, 2014
  22. Matthieu MoyJul 17, 2014
  23. Tanay AbhraJul 17, 2014
  24. Matthieu MoyJul 17, 2014
  25. Matthieu MoyJul 17, 2014
  26. Junio C HamanoJul 17, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.