Skip to content

Commit 2cb2dcb

Browse files
Fix positioning of refs after fast forward merge
Signed-off-by: Jacob Stopak <[email protected]>
1 parent 95c6fdf commit 2cb2dcb

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

git_sim/git_sim_base_command.py

+14
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,20 @@ def reset_head_branch(self, hexsha, shift=numpy.array([0.0, 0.0, 0.0])):
818818
)
819819
)
820820

821+
def reset_head_branch_to_ref(self, ref, shift=numpy.array([0.0, 0.0, 0.0])):
822+
if settings.animate:
823+
self.play(self.drawnRefs["HEAD"].animate.next_to(ref, m.UP))
824+
self.play(
825+
self.drawnRefs[self.repo.active_branch.name].animate.next_to(
826+
self.drawnRefs["HEAD"], m.UP
827+
)
828+
)
829+
else:
830+
self.drawnRefs["HEAD"].next_to(ref, m.UP)
831+
self.drawnRefs[self.repo.active_branch.name].next_to(
832+
self.drawnRefs["HEAD"], m.UP
833+
)
834+
821835
def translate_frame(self, shift):
822836
if settings.animate:
823837
self.play(self.camera.frame.animate.shift(shift))

git_sim/merge.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ def construct(self):
5858
head_commit = self.get_commit()
5959
branch_commit = self.get_commit(self.branch)
6060

61-
# Use forward slash to determine if supplied branch arg is local or remote tracking branch
6261
if not self.is_remote_tracking_branch(self.branch):
6362
if self.branch in self.repo.git.branch("--contains", head_commit.hexsha):
6463
self.ff = True
@@ -82,8 +81,10 @@ def construct(self):
8281

8382
self.recenter_frame()
8483
self.scale_frame()
85-
if "HEAD" in self.drawnRefs:
84+
if "HEAD" in self.drawnRefs and self.no_ff:
8685
self.reset_head_branch(reset_head_to, shift=shift)
86+
elif "HEAD" in self.drawnRefs:
87+
self.reset_head_branch_to_ref(self.topref, shift=shift)
8788
else:
8889
self.draw_ref(branch_commit, commitId if self.no_ff else self.topref)
8990
self.draw_ref(

0 commit comments

Comments
 (0)