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. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller committed
Jun 20, 2018 at 15:32 UTC
ba95d4e4bdf03badef6bc5c44bc059464f3e79d3
2 files changed
+3
-2
submodule.c
+1
-1
@@ -1663,7 +1663,7 @@ int submodule_move_head(const char *path,
1663
argv_array_push(&cp.args, new ? new : EMPTY_TREE_SHA1_HEX);
1664
1665
if (run_command(&cp)) {
1666
- ret = -1;
1666
+ ret = error(_("Submodule '%s' could not be updated."), path);
1667
goto out;
1668
}
1669
t/lib-submodule-update.sh
+2
-1
@@ -781,7 +781,8 @@ test_submodule_recursing_with_args_common() {
781
(
782
cd submodule_update &&
783
git branch -t invalid_sub1 origin/invalid_sub1 &&
784
- test_must_fail $command invalid_sub1 &&
784
+ test_must_fail $command invalid_sub1 2>err &&
785
+ test_i18ngrep sub1 err &&
786
test_superproject_content origin/add_sub1 &&
787
test_submodule_content sub1 origin/add_sub1
788
)