Skip to content

Commit 8c59ba9

Browse files
committed
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
2 parents bca6aba + 581d2fd commit 8c59ba9

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

sha1-name.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1843,7 +1843,7 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo,
18431843
if (flags & GET_OID_RECORD_PATH)
18441844
oc->path = xstrdup(cp);
18451845

1846-
if (!repo->index->cache)
1846+
if (!repo->index || !repo->index->cache)
18471847
repo_read_index(repo);
18481848
pos = index_name_pos(repo->index, cp, namelen);
18491849
if (pos < 0)

t/t7411-submodule-config.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,18 +243,14 @@ test_expect_success 'reading nested submodules config' '
243243
)
244244
'
245245

246-
# When this test eventually passes, before turning it into
247-
# test_expect_success, remember to replace the test_i18ngrep below with
248-
# a "test_must_be_empty warning" to be sure that the warning is actually
249-
# removed from the code.
250-
test_expect_failure 'reading nested submodules config when .gitmodules is not in the working tree' '
246+
test_expect_success 'reading nested submodules config when .gitmodules is not in the working tree' '
251247
test_when_finished "git -C super/submodule checkout .gitmodules" &&
252248
(cd super &&
253249
echo "./nested_submodule" >expect &&
254250
rm submodule/.gitmodules &&
255251
test-tool submodule-nested-repo-config \
256252
submodule submodule.nested_submodule.url >actual 2>warning &&
257-
test_i18ngrep "nested submodules without %s in the working tree are not supported yet" warning &&
253+
test_must_be_empty warning &&
258254
test_cmp expect actual
259255
)
260256
'

0 commit comments

Comments
 (0)