Skip to content

Commit ba95d4e

Browse files
stefanbellergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a42a58d commit ba95d4e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

submodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1663,7 +1663,7 @@ int submodule_move_head(const char *path,
16631663
argv_array_push(&cp.args, new ? new : EMPTY_TREE_SHA1_HEX);
16641664

16651665
if (run_command(&cp)) {
1666-
ret = -1;
1666+
ret = error(_("Submodule '%s' could not be updated."), path);
16671667
goto out;
16681668
}
16691669

t/lib-submodule-update.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,8 @@ test_submodule_recursing_with_args_common() {
781781
(
782782
cd submodule_update &&
783783
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 &&
785786
test_superproject_content origin/add_sub1 &&
786787
test_submodule_content sub1 origin/add_sub1
787788
)

0 commit comments

Comments
 (0)