diff options
author | Russell Belfer <rb@github.com> | 2013-06-28 09:29:05 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-06-28 09:29:05 +0400 |
commit | 1e9dd60f141cbe0c0eecf2628f7dd6f67d185b8d (patch) | |
tree | f007044f83a959d38dba6fb441bd13d6d23ac366 /src/submodule.c | |
parent | d0c36a0baf42d751c23e13df08c7ec9f800dd40f (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.c | 7 |
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); |