File tree Expand file tree Collapse file tree 1 file changed +23
-13
lines changed
Expand file tree Collapse file tree 1 file changed +23
-13
lines changed Original file line number Diff line number Diff line change @@ -127,19 +127,7 @@ impl PullComponent {
127127 self . git_fetch . last_result ( ) ?
128128 {
129129 if err. is_empty ( ) {
130- let merge_res =
131- sync:: branch_merge_upstream_fastforward (
132- CWD ,
133- & self . branch ,
134- ) ;
135- if let Err ( err) = merge_res {
136- self . queue . borrow_mut ( ) . push_back (
137- InternalEvent :: ShowErrorMsg ( format ! (
138- "merge failed:\n {}" ,
139- err
140- ) ) ,
141- ) ;
142- }
130+ self . do_merge ( ) ?;
143131 } else {
144132 self . queue . borrow_mut ( ) . push_back (
145133 InternalEvent :: ShowErrorMsg ( format ! (
@@ -154,6 +142,28 @@ impl PullComponent {
154142
155143 Ok ( ( ) )
156144 }
145+
146+ // check if something is incoming and try a ff merge then
147+ fn do_merge ( & self ) -> Result < ( ) > {
148+ let branch_compare =
149+ sync:: branch_compare_upstream ( CWD , & self . branch ) ?;
150+ if branch_compare. behind > 0 {
151+ let merge_res = sync:: branch_merge_upstream_fastforward (
152+ CWD ,
153+ & self . branch ,
154+ ) ;
155+ if let Err ( err) = merge_res {
156+ self . queue . borrow_mut ( ) . push_back (
157+ InternalEvent :: ShowErrorMsg ( format ! (
158+ "merge failed:\n {}" ,
159+ err
160+ ) ) ,
161+ ) ;
162+ }
163+ }
164+
165+ Ok ( ( ) )
166+ }
157167}
158168
159169impl DrawableComponent for PullComponent {
You can’t perform that action at this time.
0 commit comments