git: adjust error on submodule update failure

Now instead of reporting single generic "submodule update failed" a
dependency specific submodule update failed error message will be
reported and shown without --verbose.
This commit is contained in:
Joonas Koivunen 2017-04-14 08:38:55 +03:00
parent 072d89ecb4
commit d31f24bdbb
2 changed files with 8 additions and 9 deletions

View file

@ -156,9 +156,7 @@ impl GitDatabase {
}
Err(..) => GitCheckout::clone_into(dest, self, rev)?,
};
checkout.update_submodules(cargo_config).chain_error(|| {
internal("failed to update submodules")
})?;
checkout.update_submodules(cargo_config)?;
Ok(checkout)
}
@ -297,8 +295,8 @@ impl<'a> GitCheckout<'a> {
for mut child in repo.submodules()?.into_iter() {
update_submodule(repo, &mut child, cargo_config).chain_error(||
internal(
format!("failed to update submodule `{}`",
human(
format!("Failed to update submodule `{}`",
child.name().unwrap_or("")))
)?;
}

View file

@ -796,17 +796,18 @@ fn dep_with_bad_submodule() {
pub fn foo() { dep1::dep() }
");
assert_that(project.cargo_process("build").arg("--verbose"),
assert_that(project.cargo_process("build"),
execs().with_stderr(format!("\
[UPDATING] git repository [..]
[ERROR] failed to load source for a dependency on `dep1`
Caused by:
Failed to update submodules of [..]
Unable to update {}
Caused by:
[9/-3] object not found - no match for id ({})
", original_submodule_ref)).with_status(101));
Failed to update submodule `src`
To learn more, run the command again with --verbose.\n", path2url(git_project.root()))).with_status(101));
}
#[test]