File tree 1 file changed +23
-13
lines changed
1 file changed +23
-13
lines changed Original file line number Diff line number Diff line change @@ -127,19 +127,7 @@ impl PullComponent {
127
127
self . git_fetch . last_result ( ) ?
128
128
{
129
129
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 ( ) ?;
143
131
} else {
144
132
self . queue . borrow_mut ( ) . push_back (
145
133
InternalEvent :: ShowErrorMsg ( format ! (
@@ -154,6 +142,28 @@ impl PullComponent {
154
142
155
143
Ok ( ( ) )
156
144
}
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
+ }
157
167
}
158
168
159
169
impl DrawableComponent for PullComponent {
You can’t perform that action at this time.
0 commit comments