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

[PATCH] notes: fix malformed tree entry

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 25, 2010, 05:58 UTC
Message-ID
<7vocjdkgaz.fsf@alter.siamese.dyndns.org>

The mode bits for entries in a tree object should be an octal number with minimum number of digits. Do not pad it with 0 to the left.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 * This comes from 61a7cca (Notes API: write_notes_tree(): Store the notes
   tree in the database, 2010-02-13)
 notes.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/notes.c b/notes.c
index 3ba3e6d..a4f9926 100644
--- a/notes.c
+++ b/notes.c
@@ -624,8 +624,8 @@ static void write_tree_entry(struct strbuf *buf, unsigned int mode,
 		const char *path, unsigned int path_len, const
 		unsigned char *sha1)
 {
-		strbuf_addf(buf, "%06o %.*s%c", mode, path_len, path, '\0');
-		strbuf_add(buf, sha1, 20);
+	strbuf_addf(buf, "%o %.*s%c", mode, path_len, path, '\0');
+	strbuf_add(buf, sha1, 20);
 }
 
 static void tree_write_stack_init_subtree(struct tree_write_stack *tws,
-- 
1.7.0.227.g2f3f2
Next: Johan Herland
Message 1 of 2 in “notes: fix malformed tree entry”
  1. notes: fix malformed tree entryJunio C Hamano, Feb 25, 2010
  2. Johan HerlandFeb 25, 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.