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

[PATCH 4/6] Rename get_mode() to decode_tree_mode() and export it

From
Tomas Carnecky <tom@dbservice.com>
Date
Oct 3, 2010, 12:21 UTC
Message-ID
<1286108511-55876-4-git-send-email-tom@dbservice.com>
In-Reply-To
<4CA86A12.6080905@dbservice.com>

Other sources (fast-import-helper.c) may want to use this function to parse trees.

Signed-off-by: Tomas Carnecky <tom@dbservice.com>
---
 tree-walk.c |    4 ++--
 tree-walk.h |    2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/tree-walk.c b/tree-walk.c
index a9bbf4e..5f51f4e 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -3,7 +3,7 @@
 #include "unpack-trees.h"
 #include "tree.h"
 
-static const char *get_mode(const char *str, unsigned int *modep)
+const char *decode_tree_mode(const char *str, unsigned int *modep)
 {
 	unsigned char c;
 	unsigned int mode = 0;
@@ -28,7 +28,7 @@ static void decode_tree_entry(struct tree_desc *desc, const char *buf, unsigned
 	if (size < 24 || buf[size - 21])
 		die("corrupt tree file");
 
-	path = get_mode(buf, &mode);
+	path = decode_tree_mode(buf, &mode);
 	if (!path || !*path)
 		die("corrupt tree file");
 	len = strlen(path) + 1;
diff --git a/tree-walk.h b/tree-walk.h
index 7e3e0b5..6bbde1c 100644
--- a/tree-walk.h
+++ b/tree-walk.h
@@ -13,6 +13,8 @@ struct tree_desc {
 	unsigned int size;
 };
 
+const char *decode_tree_mode(const char *str, unsigned int *modep);
+
 static inline const unsigned char *tree_entry_extract(struct tree_desc *desc, const char **pathp, unsigned int *modep)
 {
 	*pathp = desc->entry.path;
-- 
1.7.3.37.gb6088b
Previous: Jonathan NiederNext: Jonathan Nieder
Message 9 of 21 in “[RFC] New type of remote helpers”
  1. Tomas CarneckyOct 3, 2010
  2. 1/6 Remote helper: accept ':<value> <name>' as a response to 'list'Tomas Carnecky, Oct 3, 2010
  3. Jonathan NiederOct 5, 2010
  4. Sverre RabbelierOct 7, 2010
  5. 2/6 Allow more than one keepfile in the transportTomas Carnecky, Oct 3, 2010
  6. Jonathan NiederOct 5, 2010
  7. 3/6 Allow the transport fetch command to add additional refsTomas Carnecky, Oct 3, 2010
  8. Jonathan NiederOct 5, 2010
  9. 4/6 Rename get_mode() to decode_tree_mode() and export itTomas Carnecky, Oct 3, 2010
  10. Jonathan NiederOct 5, 2010
  11. 5/6 Introduce the git fast-import-helperTomas Carnecky, Oct 3, 2010
  12. Jonathan NiederOct 3, 2010
  13. Tomas CarneckyOct 3, 2010
  14. Sverre RabbelierOct 3, 2010
  15. Tomas CarneckyOct 3, 2010
  16. Sverre RabbelierOct 3, 2010
  17. 6/6 Add git-remote-svnTomas Carnecky, Oct 3, 2010
  18. Jonathan NiederOct 5, 2010
  19. Sverre RabbelierOct 3, 2010
  20. Jonathan NiederOct 3, 2010
  21. Ramkumar RamachandraOct 3, 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.