diff options
Diffstat (limited to 'tree.c')
-rw-r--r-- | tree.c | 30 |
1 files changed, 29 insertions, 1 deletions
@@ -110,7 +110,7 @@ int read_tree_recursive(struct tree *tree, case 0: continue; case READ_TREE_RECURSIVE: - break;; + break; default: return -1; } @@ -131,6 +131,34 @@ int read_tree_recursive(struct tree *tree, if (retval) return -1; continue; + } else if (S_ISGITLINK(entry.mode)) { + int retval; + struct strbuf path; + unsigned int entrylen; + struct commit *commit; + + entrylen = tree_entry_len(entry.path, entry.sha1); + strbuf_init(&path, baselen + entrylen + 1); + strbuf_add(&path, base, baselen); + strbuf_add(&path, entry.path, entrylen); + strbuf_addch(&path, '/'); + + commit = lookup_commit(entry.sha1); + if (!commit) + die("Commit %s in submodule path %s not found", + sha1_to_hex(entry.sha1), path.buf); + + if (parse_commit(commit)) + die("Invalid commit %s in submodule path %s", + sha1_to_hex(entry.sha1), path.buf); + + retval = read_tree_recursive(commit->tree, + path.buf, path.len, + stage, match, fn, context); + strbuf_release(&path); + if (retval) + return -1; + continue; } } return 0; |