mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 09:28:21 +00:00
only even try to ff merge when there is something incoming (#554)
* Update pull.rs
This commit is contained in:
parent
102b0b31fb
commit
dfa4d7789d
1 changed files with 23 additions and 13 deletions
|
|
@ -127,19 +127,7 @@ impl PullComponent {
|
||||||
self.git_fetch.last_result()?
|
self.git_fetch.last_result()?
|
||||||
{
|
{
|
||||||
if err.is_empty() {
|
if err.is_empty() {
|
||||||
let merge_res =
|
self.do_merge()?;
|
||||||
sync::branch_merge_upstream_fastforward(
|
|
||||||
CWD,
|
|
||||||
&self.branch,
|
|
||||||
);
|
|
||||||
if let Err(err) = merge_res {
|
|
||||||
self.queue.borrow_mut().push_back(
|
|
||||||
InternalEvent::ShowErrorMsg(format!(
|
|
||||||
"merge failed:\n{}",
|
|
||||||
err
|
|
||||||
)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
self.queue.borrow_mut().push_back(
|
self.queue.borrow_mut().push_back(
|
||||||
InternalEvent::ShowErrorMsg(format!(
|
InternalEvent::ShowErrorMsg(format!(
|
||||||
|
|
@ -154,6 +142,28 @@ impl PullComponent {
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if something is incoming and try a ff merge then
|
||||||
|
fn do_merge(&self) -> Result<()> {
|
||||||
|
let branch_compare =
|
||||||
|
sync::branch_compare_upstream(CWD, &self.branch)?;
|
||||||
|
if branch_compare.behind > 0 {
|
||||||
|
let merge_res = sync::branch_merge_upstream_fastforward(
|
||||||
|
CWD,
|
||||||
|
&self.branch,
|
||||||
|
);
|
||||||
|
if let Err(err) = merge_res {
|
||||||
|
self.queue.borrow_mut().push_back(
|
||||||
|
InternalEvent::ShowErrorMsg(format!(
|
||||||
|
"merge failed:\n{}",
|
||||||
|
err
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DrawableComponent for PullComponent {
|
impl DrawableComponent for PullComponent {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue