aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-05-19 16:45:35 +0900
committerJunio C Hamano <gitster@pobox.com>2019-05-19 16:45:35 +0900
commit8c59ba9a764f1ae1f8d176ea17c636183cfd7267 (patch)
tree5d3ae1da7adb0f2003518b0a85633b23a995240c
parentMerge branch 'jc/set-packet-header-signature-fix' (diff)
parentget_oid: handle NULL repo->index (diff)
downloadgit-8c59ba9a764f1ae1f8d176ea17c636183cfd7267.tar.xz
git-8c59ba9a764f1ae1f8d176ea17c636183cfd7267.zip
Merge branch 'jk/get-oid-indexed-object-name'
The codepath to parse :<path> that obtains the object name for an indexed object has been made more robust. * jk/get-oid-indexed-object-name: get_oid: handle NULL repo->index
-rw-r--r--sha1-name.c2
-rwxr-xr-xt/t7411-submodule-config.sh8
2 files changed, 3 insertions, 7 deletions
diff --git a/sha1-name.c b/sha1-name.c
index b4f5cadae74..728e6f1f61e 100644
--- a/sha1-name.c
+++ b/sha1-name.c
@@ -1843,7 +1843,7 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo,
if (flags & GET_OID_RECORD_PATH)
oc->path = xstrdup(cp);
- if (!repo->index->cache)
+ if (!repo->index || !repo->index->cache)
repo_read_index(repo);
pos = index_name_pos(repo->index, cp, namelen);
if (pos < 0)
diff --git a/t/t7411-submodule-config.sh b/t/t7411-submodule-config.sh
index fcc0fb82d8a..ad28e938805 100755
--- a/t/t7411-submodule-config.sh
+++ b/t/t7411-submodule-config.sh
@@ -243,18 +243,14 @@ test_expect_success 'reading nested submodules config' '
)
'
-# When this test eventually passes, before turning it into
-# test_expect_success, remember to replace the test_i18ngrep below with
-# a "test_must_be_empty warning" to be sure that the warning is actually
-# removed from the code.
-test_expect_failure 'reading nested submodules config when .gitmodules is not in the working tree' '
+test_expect_success 'reading nested submodules config when .gitmodules is not in the working tree' '
test_when_finished "git -C super/submodule checkout .gitmodules" &&
(cd super &&
echo "./nested_submodule" >expect &&
rm submodule/.gitmodules &&
test-tool submodule-nested-repo-config \
submodule submodule.nested_submodule.url >actual 2>warning &&
- test_i18ngrep "nested submodules without %s in the working tree are not supported yet" warning &&
+ test_must_be_empty warning &&
test_cmp expect actual
)
'