mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-23 09:33:01 +03:00
fetch after push
This commit is contained in:
parent
488f7862f5
commit
d95cbdb738
@ -1508,6 +1508,7 @@ pub fn push(
|
|||||||
branch_writer
|
branch_writer
|
||||||
.write(&vbranch)
|
.write(&vbranch)
|
||||||
.context("failed to write target branch after push")?;
|
.context("failed to write target branch after push")?;
|
||||||
|
fetch(project_path).context("failed to fetch after push")?;
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(anyhow::anyhow!(
|
Err(anyhow::anyhow!(
|
||||||
@ -1517,6 +1518,24 @@ pub fn push(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn fetch(project_path: &str) -> Result<()> {
|
||||||
|
let output = Command::new("git")
|
||||||
|
.arg("fetch")
|
||||||
|
.arg("origin")
|
||||||
|
.current_dir(project_path)
|
||||||
|
.output()
|
||||||
|
.context("failed to fork exec")?;
|
||||||
|
|
||||||
|
if output.status.success() {
|
||||||
|
Ok(())
|
||||||
|
} else {
|
||||||
|
Err(anyhow::anyhow!(
|
||||||
|
"failed to fetch: {}",
|
||||||
|
String::from_utf8(output.stderr)?
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use tempfile::tempdir;
|
use tempfile::tempdir;
|
||||||
|
Loading…
Reference in New Issue
Block a user