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

[PATCH 2/4] fast-import: set valid mode on root tree in "ls"

From
John Keeping <john@keeping.me.uk>
Date
Jun 23, 2013, 14:58 UTC
Message-ID
<093e9ce49bf92d81c3a7a11d91292be675eaf6fa.1371999369.git.john@keeping.me.uk>
In-Reply-To
<cover.1371999369.git.john@keeping.me.uk>

This prevents a failure later when we lift the restriction on ls with the empty path.

Signed-off-by: John Keeping <john@keeping.me.uk>
---
 fast-import.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/fast-import.c b/fast-import.c
index 23f625f..bdbadea 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -3051,6 +3051,8 @@ static void parse_ls(struct branch *b)
 		struct object_entry *e = parse_treeish_dataref(&p);
 		root = new_tree_entry();
 		hashcpy(root->versions[1].sha1, e->idx.sha1);
+		if (!is_null_sha1(root->versions[1].sha1))
+			root->versions[1].mode = S_IFDIR;
 		load_tree(root);
 		if (*p++ != ' ')
 			die("Missing space after tree-ish: %s", command_buf.buf);
-- 
1.8.3.1.676.gaae6535
Previous: John KeepingNext: John Keeping
Message 3 of 6 in “fast-import: handle empty paths better”
  1. 0/4 fast-import: handle empty paths betterJohn Keeping, Jun 23, 2013
  2. 1/4 t9300: document fast-import empty path issuesJohn Keeping, Jun 23, 2013
  3. 2/4 fast-import: set valid mode on root tree in "ls"John Keeping, Jun 23, 2013
  4. 3/4 fast-import: allow ls or filecopy of the root treeJohn Keeping, Jun 23, 2013
  5. 4/4 fast-import: allow moving the root treeJohn Keeping, Jun 23, 2013
  6. Junio C HamanoJul 1, 2013

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.