Skip to contentSkip to conversation

submodule: correct error message for missing commits.

PATCH In review Stefan Beller 3 participants 3 messages Sep 26, 2017 – Sep 27, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 submodule.c                               | 2 +-
 t/t4059-diff-submodule-not-initialized.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
submodule.c +1 -1
index 6531c5d609..280c246477 100644
@@ -567,7 +567,7 @@ static void show_submodule_header(FILE *f, const char *path,
 
 	if (add_submodule_odb(path)) {
 		if (!message)
-			message = "(not initialized)";
+			message = "(commits not present)";
 		goto output_header;
 	}
 
t/t4059-diff-submodule-not-initialized.sh +1 -1
index cd70fd5192..49bca7b48d 100755
@@ -95,7 +95,7 @@ test_expect_success 'submodule not initialized in new clone' '
 	git clone . sm3 &&
 	git -C sm3 diff-tree -p --no-commit-id --submodule=log HEAD >actual &&
 	cat >expected <<-EOF &&
-	Submodule sm1 $smhead1...$smhead2 (not initialized)
+	Submodule sm1 $smhead1...$smhead2 (commits not present)
 	EOF
 	test_cmp expected actual
 '
Signature · 1 line
2.14.0.rc0.3.g6c2e499285
#1 lore raw
Quoted 15 lines · Stefan Beller

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.

Quoted 5 lines

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.

This makes sense to me.

Thanks,
Jake

Quoted 34 lines
---
 submodule.c                               | 2 +-
 t/t4059-diff-submodule-not-initialized.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
submodule.c +1 -1
index 6531c5d609..280c246477 100644
@@ -567,7 +567,7 @@ static void show_submodule_header(FILE *f, const char *path,
 
        if (add_submodule_odb(path)) {
                if (!message)
-                       message = "(not initialized)";
+                       message = "(commits not present)";
                goto output_header;
        }
 
t/t4059-diff-submodule-not-initialized.sh +1 -2
index cd70fd5192..49bca7b48d 100755
@@ -95,7 +95,7 @@ test_expect_success 'submodule not initialized in new clone' '
        git clone . sm3 &&
        git -C sm3 diff-tree -p --no-commit-id --submodule=log HEAD >actual &&
        cat >expected <<-EOF &&
-       Submodule sm1 $smhead1...$smhead2 (not initialized)
+       Submodule sm1 $smhead1...$smhead2 (commits not present)
        EOF
        test_cmp expected actual
 '
--

2.14.0.rc0.3.g6c2e499285

#2 lore raw
In reply to Stefan Beller
Quoted 15 lines · Stefan Beller

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.

Quoted 6 lines

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.

---

Sounds good. Thanks for working on it.