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

[RFC/ PATCH 1/5] tree-walk: do not stop when an error is detected

From
DGDiane Gasselin <diane.gasselin@ensimag.imag.fr>
Date
Jun 9, 2010, 12:44 UTC
Message-ID
<1276087446-25112-3-git-send-email-diane.gasselin@ensimag.imag.fr>
In-Reply-To
<1276087446-25112-2-git-send-email-diane.gasselin@ensimag.imag.fr>
From: Diane <diane.gasselin@ensimag.imag.fr>

When an error is detected, traverse_trees() is not stopped anymore. The whole tree is traversed so that all the merging errors can be detected.

Signed-off-by: Diane Gasselin <diane.gasselin@ensimag.imag.fr>
Signed-off-by: Axel Bonnet <axel.bonnet@ensimag.imag.fr>
Signed-off-by: Clément Poulain <clement.poulain@ensimag.imag.fr>
---
 tree-walk.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/tree-walk.c b/tree-walk.c
index 67a9a0c..04072aa 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -310,6 +310,7 @@ static void free_extended_entry(struct tree_desc_x *t)
 int traverse_trees(int n, struct tree_desc *t, struct traverse_info *info)
 {
 	int ret = 0;
+	int error = 0;
 	struct name_entry *entry = xmalloc(n*sizeof(*entry));
 	int i;
 	struct tree_desc_x *tx = xcalloc(n, sizeof(*tx));
@@ -378,7 +379,7 @@ int traverse_trees(int n, struct tree_desc *t, struct traverse_info *info)
 			break;
 		ret = info->fn(n, mask, dirmask, entry, info);
 		if (ret < 0)
-			break;
+			error = ret;
 		mask &= ret;
 		ret = 0;
 		for (i = 0; i < n; i++)
@@ -389,7 +390,7 @@ int traverse_trees(int n, struct tree_desc *t, struct traverse_info *info)
 	for (i = 0; i < n; i++)
 		free_extended_entry(tx + i);
 	free(tx);
-	return ret;
+	return error;
 }
 
 static int find_tree_entry(struct tree_desc *t, const char *name, unsigned char *result, unsigned *mode)
-- 
1.6.6.7.ga5fe3
Previous: Diane GasselinNext: Diane Gasselin
Message 3 of 21 in “unpack_trees: nicer error messages”
  1. 0/5 unpack_trees: nicer error messagesDiane Gasselin, Jun 9, 2010
  2. 0/5 unpack_trees: nicer error messagesDiane Gasselin, Jun 9, 2010
  3. 1/5 tree-walk: do not stop when an error is detectedDiane Gasselin, Jun 9, 2010
  4. 2/5 unpack_trees: group errors by typeDiane Gasselin, Jun 9, 2010
  5. 3/5 unpack_trees_options: update porcelain messagesDiane Gasselin, Jun 9, 2010
  6. 4/5 t3030: update porcelain expected messageDiane Gasselin, Jun 9, 2010
  7. 5/5 t7609: test merge and checkout error messagesDiane Gasselin, Jun 9, 2010
  8. Matthieu MoyJun 9, 2010
  9. Diane GasselinJun 9, 2010
  10. Matthieu MoyJun 9, 2010
  11. Junio C HamanoJun 9, 2010
  12. Matthieu MoyJun 9, 2010
  13. Jeff KingJun 10, 2010
  14. Diane GasselinJun 10, 2010
  15. Diane GasselinJun 9, 2010
  16. Junio C HamanoJun 9, 2010
  17. Diane GasselinJun 10, 2010
  18. Matthieu MoyJun 9, 2010
  19. Junio C HamanoJun 9, 2010
  20. Diane GasselinJun 9, 2010
  21. Matthieu MoyJun 9, 2010

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.