Skip to content

Commit ad19d8a

Browse files
committed
models.main: exit amend mode when merging
Detect when we've somehow a state where we're amending and in the middle of a merge. Reset the mode back to "none" when this happens. This can happen if the user enters "amend" mode and then merges a branch, either through the UI or via the command-line. We now avoid this undesirable state by automatically disabling the "amend" mode when an update detects that we are in the middle of a merge. Signed-off-by: David Aguilar <davvid@gmail.com>
1 parent 1af564f commit ad19d8a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cola/models/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,11 @@ def update_file_status(self, update_index=False):
171171
def update_status(self, update_index=False):
172172
# Give observers a chance to respond
173173
self.notify_observers(self.message_about_to_update)
174+
self._update_merge_rebase_status()
174175
self._update_files(update_index=update_index)
175176
self._update_refs()
176177
self._update_branches_and_tags()
177178
self._update_branch_heads()
178-
self._update_merge_rebase_status()
179179
self.notify_observers(self.message_updated)
180180

181181
def _update_files(self, update_index=False):
@@ -218,6 +218,8 @@ def _update_branches_and_tags(self):
218218
def _update_merge_rebase_status(self):
219219
self.is_merging = core.exists(self.git.git_path('MERGE_HEAD'))
220220
self.is_rebasing = core.exists(self.git.git_path('rebase-merge'))
221+
if self.is_merging and self.mode == self.mode_amend:
222+
self.set_mode(self.mode_none)
221223

222224
def delete_branch(self, branch):
223225
return self.git.branch(branch, D=True)

0 commit comments

Comments
 (0)