submodule.c: report the submodule that an error occurs in
PATCH 1/1 submodule.c: report the submodule that an error occurs in
When an error occurs in updating the working tree of a submodule in submodule_move_head, tell the user which submodule the error occurred in.
The call to read-tree contains a super-prefix, such that the read-tree will correctly report any path related issues, but some error messages do not contain a path, for example:
~/gerrit$ git checkout --recurse-submodules origin/master
~/gerrit$ fatal: failed to unpack tree object 07672f31880ba80300b38492df9d0acfcd6ee00a
Give the hint which submodule has a problem.
--- submodule.c | 2 +- t/lib-submodule-update.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
submodule.c +1 -1
@@ -1668,7 +1668,7 @@ int submodule_move_head(const char *path,argv_array_push (&cp.args, new_head ? new_head :empty_tree_oid_hex ());if (run_command (&cp)) { - ret =-1 ; + ret =error (_ ("Submodule '%s' could not be updated." ), path); goto out; }
t/lib-submodule-update.sh +2 -1
@@ -781,7 +781,8 @@ test_submodule_recursing_with_args_common() { ( cd submodule_update && git branch -t invalid_sub1 origin/invalid_sub1 && - test_must_fail $command invalid_sub1 && + test_must_fail $command invalid_sub1 2>err && + grep sub1 err && test_superproject_content origin/add_sub1 && test_submodule_content sub1 origin/add_sub1 )
Signature · 1 line
2.18.0.rc2.346.g013aa6912e-goog
Quoted 23 lines · Stefan Beller
When an error occurs in updating the working tree of a submodule in
submodule_move_head, tell the user which submodule the error occurred in.The call to read-tree contains a super-prefix, such that the read-tree will correctly report any path related issues, but some error messages do not contain a path, for example:
~/gerrit$ git checkout --recurse-submodules origin/master
~/gerrit$ fatal: failed to unpack tree object07672f31880ba80300b38492df9d0acfcd6ee00aGive the hint which submodule has a problem.
Signed-off-by Stefan Beller <[email protected]>--- submodule.c | 2 +- t/lib-submodule-update.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)submodule.c +0
-0
submodule.c int submodule_move_head(const char *path, · line 1673
Quoted 7 lines
submodule.c +1
-1@@ -1668,7 +1668,7 @@ int submodule_move_head(const char *path,argv_array_push (&cp.args, new_head ? new_head :empty_tree_oid_hex ());if (run_command (&cp)) { - ret =-1 ; + ret =error (_ ("Submodule '%s' could not be updated." ), path); goto out; }
OK. The function uses path in messages elsewhere so we know path must not be empty and have a reasonable string content at this point, which makes this a reasonably safe patch to apply ;-)
Thanks.
Quoted 14 lines
t/lib-submodule-update.sh +2
-1@@ -781,7 +781,8 @@ test_submodule_recursing_with_args_common() { ( cd submodule_update && git branch -t invalid_sub1 origin/invalid_sub1 && - test_must_fail $command invalid_sub1 && + test_must_fail $command invalid_sub1 2>err && + grep sub1 err && test_superproject_content origin/add_sub1 && test_submodule_content sub1 origin/add_sub1 )
Quoted 24 lines
When an error occurs in updating the working tree of a submodule in
submodule_move_head, tell the user which submodule the error occurred in.The call to read-tree contains a super-prefix, such that the read-tree will correctly report any path related issues, but some error messages do not contain a path, for example:
~/gerrit$ git checkout --recurse-submodules origin/master
~/gerrit$ fatal: failed to unpack tree object07672f31880ba80300b38492df9d0acfcd6ee00aGive the hint which submodule has a problem.
Signed-off-by Stefan Beller <[email protected]>--- submodule.c | 2 +- t/lib-submodule-update.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)submodule.c +0
-0
submodule.c int submodule_move_head(const char *path, · line 1671
Quoted 5 lines
submodule.c +1
-1@@ -1668,7 +1668,7 @@ int submodule_move_head(const char *path,argv_array_push (&cp.args, new_head ? new_head :empty_tree_oid_hex ());if (run_command (&cp)) { - ret =-1 ; + ret =error (_ ("Submodule '%s' could not be updated." ), path);
This is a translated error message ...
Quoted 8 lines
submodule.c +0
-0goto out; }t/lib-submodule-update.sh +0
-0
t/lib-submodule-update.sh test_submodule_recursing_with_args_common() { · line 785
Quoted 6 lines
t/lib-submodule-update.sh +2
-1@@ -781,7 +781,8 @@ test_submodule_recursing_with_args_common() { ( cd submodule_update && git branch -t invalid_sub1 origin/invalid_sub1 && - test_must_fail $command invalid_sub1 && + test_must_fail $command invalid_sub1 2>err && + grep sub1 err &&
... so the test should use 'test_i18ngrep' to check it.
Quoted 7 lines
t/lib-submodule-update.sh +0
-0test_superproject_content origin/add_sub1 && test_submodule_content sub1 origin/add_sub1 )Signature · 1 line
2.18.0.rc2.346.g013aa6912e-goog
Quoted 34 lines · SZEDER Gábor
Quoted 23 lines
When an error occurs in updating the working tree of a submodule in
submodule_move_head, tell the user which submodule the error occurred in.The call to read-tree contains a super-prefix, such that the read-tree will correctly report any path related issues, but some error messages do not contain a path, for example:
~/gerrit$ git checkout --recurse-submodules origin/master
~/gerrit$ fatal: failed to unpack tree object07672f31880ba80300b38492df9d0acfcd6ee00aGive the hint which submodule has a problem.
Signed-off-by Stefan Beller <[email protected]>--- submodule.c | 2 +- t/lib-submodule-update.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)submodule.c +0
-0submodule.c int submodule_move_head(const char *path, · line 1671
Quoted 5 lines
submodule.c +1
-1@@ -1668,7 +1668,7 @@ int submodule_move_head(const char *path,argv_array_push (&cp.args, new_head ? new_head :empty_tree_oid_hex ());if (run_command (&cp)) { - ret =-1 ; + ret =error (_ ("Submodule '%s' could not be updated." ), path);This is a translated error message ...
Quoted 3 lines
submodule.c +0
-0goto out; }
Quoted 13 lines
t/lib-submodule-update.sh test_submodule_recursing_with_args_common() { · line 785
Quoted 11 lines
t/lib-submodule-update.sh +2
-1@@ -781,7 +781,8 @@ test_submodule_recursing_with_args_common() { ( cd submodule_update && git branch -t invalid_sub1 origin/invalid_sub1 && - test_must_fail $command invalid_sub1 && + test_must_fail $command invalid_sub1 2>err && + grep sub1 err &&... so the test should use '
test_i18ngrep' to check it.
Thanks for being a careful reviewer, as always.
Will tweak locally to skip one round-trip.
Quoted 51 lines · Junio C Hamano
Quoted 34 lines · SZEDER Gábor
Quoted 23 lines
When an error occurs in updating the working tree of a submodule in
submodule_move_head, tell the user which submodule the error occurred in.The call to read-tree contains a super-prefix, such that the read-tree will correctly report any path related issues, but some error messages do not contain a path, for example:
~/gerrit$ git checkout --recurse-submodules origin/master
~/gerrit$ fatal: failed to unpack tree object07672f31880ba80300b38492df9d0acfcd6ee00aGive the hint which submodule has a problem.
Signed-off-by Stefan Beller <[email protected]>--- submodule.c | 2 +- t/lib-submodule-update.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)submodule.c +0
-0submodule.c int submodule_move_head(const char *path, · line 1671
Quoted 5 lines
submodule.c +1
-1@@ -1668,7 +1668,7 @@ int submodule_move_head(const char *path,argv_array_push (&cp.args, new_head ? new_head :empty_tree_oid_hex ());if (run_command (&cp)) { - ret =-1 ; + ret =error (_ ("Submodule '%s' could not be updated." ), path);This is a translated error message ...
Quoted 3 lines
submodule.c +0
-0goto out; }Quoted 13 lines
t/lib-submodule-update.sh test_submodule_recursing_with_args_common() { · line 785
Quoted 11 lines
t/lib-submodule-update.sh +2
-1@@ -781,7 +781,8 @@ test_submodule_recursing_with_args_common() { ( cd submodule_update && git branch -t invalid_sub1 origin/invalid_sub1 && - test_must_fail $command invalid_sub1 && + test_must_fail $command invalid_sub1 2>err && + grep sub1 err &&... so the test should use '
test_i18ngrep' to check it.
Quoted 3 lines
Thanks for being a careful reviewer, as always.
Will tweak locally to skip one round-trip.
Thanks for tweaking locally. I reviewed your queued patch and it looks good to me. Thanks!
I remember deliberately not using the i18n grep as we grep for a part that should stay the same in all languages. However I forgot that details of the test suite implementation (it doesn't have a real translation, so it doesn't matter that this particular piece of the message will show up in all translations)
Sorry for my mishap in thinking there.
Thanks,
Stefan