Skip to content

Commit 2d94dd2

Browse files
stefanbellergitster
authored andcommitted
submodule: correct error message for missing commits
When a submodule diff should be displayed we currently just add the submodule objects to the main object store and then e.g. walk the revision graph and create a summary for that submodule. It is possible that we are missing the submodule either completely or partially, which we currently differentiate with different error messages depending on whether (1) the whole submodule object store is missing or (2) just the needed for this particular diff. (1) is reported as "not initialized", and (2) is reported as "commits not present". If a submodule is deinit'ed its repository data is still around inside the superproject, such that the diff can still be produced. In that way the error message (1) is misleading as we can have a diff despite the submodule being not initialized. Downgrade the error message (1) to be the same as (2) and just say the commits are not present, as that is the true reason why the diff cannot be shown. Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7451fcd commit 2d94dd2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

submodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ static void show_submodule_header(struct diff_options *o, const char *path,
503503

504504
if (add_submodule_odb(path)) {
505505
if (!message)
506-
message = "(not initialized)";
506+
message = "(commits not present)";
507507
goto output_header;
508508
}
509509

t/t4059-diff-submodule-not-initialized.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ test_expect_success 'submodule not initialized in new clone' '
9595
git clone . sm3 &&
9696
git -C sm3 diff-tree -p --no-commit-id --submodule=log HEAD >actual &&
9797
cat >expected <<-EOF &&
98-
Submodule sm1 $smhead1...$smhead2 (not initialized)
98+
Submodule sm1 $smhead1...$smhead2 (commits not present)
9999
EOF
100100
test_cmp expected actual
101101
'

0 commit comments

Comments
 (0)