summaryrefslogtreecommitdiff
path: root/src/tree.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2016-03-04 12:34:38 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2016-03-04 12:38:28 +0100
commitea5bf6bbcead5a9ba24a38c4da62ee87059c5c9f (patch)
tree8fa7398e57a81cc2a357831b9289de27c3edd1d3 /src/tree.c
parent16099833772cb497eac4118350e974abf08c8032 (diff)
downloadlibgit2-cmn/treebuilder-submodule.tar.gz
treebuilder: don't try to verify submodules exist in the odbcmn/treebuilder-submodule
Submodules don't exist in the objectdb and the code is making us try to look for a blob with its commit id, which is obviously not going to work. Skip the test if the user wants to insert a submodule.
Diffstat (limited to 'src/tree.c')
-rw-r--r--src/tree.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/tree.c b/src/tree.c
index 2c3151546..48b9f121d 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -757,7 +757,8 @@ int git_treebuilder_insert(
if (!valid_entry_name(bld->repo, filename))
return tree_error("Failed to insert entry. Invalid name for a tree entry", filename);
- if (!git_object__is_valid(bld->repo, id, otype_from_mode(filemode)))
+ if (filemode != GIT_FILEMODE_COMMIT &&
+ !git_object__is_valid(bld->repo, id, otype_from_mode(filemode)))
return tree_error("Failed to insert entry; invalid object specified", filename);
pos = git_strmap_lookup_index(bld->map, filename);