Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-06-28 09:29:05 +0400
committerRussell Belfer <rb@github.com>2013-06-28 09:29:05 +0400
commit1e9dd60f141cbe0c0eecf2628f7dd6f67d185b8d (patch)
treef007044f83a959d38dba6fb441bd13d6d23ac366 /src/submodule.c
parentd0c36a0baf42d751c23e13df08c7ec9f800dd40f (diff)
Test submodules with empty index or orphaned head
In both of these cases, the submodule data should still be loaded just (obviously) without the data that comes from either the index or the HEAD. This fixes a bug in the orphaned head case.
Diffstat (limited to 'src/submodule.c')
-rw-r--r--src/submodule.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/submodule.c b/src/submodule.c
index 89eba2aa4..dcd58d016 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -1176,8 +1176,11 @@ static int load_submodule_config_from_head(
git_iterator *i;
const git_index_entry *entry;
- if ((error = git_repository_head_tree(&head, repo)) < 0)
- return error;
+ /* if we can't look up current head, then there's no submodule in it */
+ if (git_repository_head_tree(&head, repo) < 0) {
+ giterr_clear();
+ return 0;
+ }
if ((error = git_iterator_for_tree(&i, head, 0, NULL, NULL)) < 0) {
git_tree_free(head);