Commit 11acb0ac authored by Brad King's avatar Brad King Committed by Kitware Robot

Merge topic 'prepare-safety'

678e4b7d prepare: use stderr as-is
d9ce4e27 prepare: log when a submodule isn't configured properly
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !60
parents 1d392f62 678e4b7d
Pipeline #115475 passed with stage
in 0 seconds
......@@ -223,13 +223,14 @@ fn checkout_files(ctx: &WorkareaGitContext, files: &[u8]) -> Result<()> {
.chain_err(|| ErrorKind::Git("writing to checkout-index".to_string()))?;
let res = checkout_index.wait().expect("expected checkout-index to execute successfully");
if !res.success() {
let mut stderr = String::new();
let mut stderr = Vec::new();
checkout_index.stderr
.as_mut()
.expect("expected checkout-index to have a stderr")
.read_to_string(&mut stderr)
.read_to_end(&mut stderr)
.chain_err(|| "failed to read from checkout-index")?;
bail!(ErrorKind::Git(format!("running checkout-index: {}", stderr)));
bail!(ErrorKind::Git(format!("running checkout-index: {}",
String::from_utf8_lossy(&stderr))));
}
// Update the index for the files we put into the context
......@@ -248,13 +249,14 @@ fn checkout_files(ctx: &WorkareaGitContext, files: &[u8]) -> Result<()> {
.chain_err(|| ErrorKind::Git("writing to update-index".to_string()))?;
let res = update_index.wait().expect("expected update-index to execute successfully");
if !res.success() {
let mut stderr = String::new();
let mut stderr = Vec::new();
update_index.stderr
.as_mut()
.expect("expected update-index to have a stderr")
.read_to_string(&mut stderr)
.read_to_end(&mut stderr)
.chain_err(|| "failed to read from update-index")?;
bail!(ErrorKind::Git(format!("running update-index: {}", stderr)));
bail!(ErrorKind::Git(format!("running update-index: {}",
String::from_utf8_lossy(&stderr))));
}
Ok(())
......@@ -446,8 +448,17 @@ impl GitWorkArea {
continue;
}
let path = config.get("path")
.expect("the 'path` configuration for submodules is required.");
let path = match config.get("path") {
Some(path) => path,
None => {
error!(target: "git.workarea",
"{}: submodule configuration for {}.path does not exist (skipping): {}",
file_name(self.dir.path()),
name,
gitdir.display());
continue;
},
};
let gitfiledir = self.work_tree().join(path);
fs::create_dir_all(&gitfiledir).chain_err(|| {
format!("failed to create the {} submodule directory for the workarea",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment