From c49eda035eafc8f6cade11a9e49d6e00b90ef3df Mon Sep 17 00:00:00 2001 From: Gregor Riegler Date: Fri, 20 Sep 2024 17:59:11 +0200 Subject: [PATCH] done pulls if already done Co-authored-by: Dario Zanotto Co-authored-by: Martin Sereinig Co-authored-by: Harald Reingruber Co-authored-by: Michael Weichselbaumer <02.angeln-statuten@icloud.com> Co-authored-by: Ricardo Colombo Co-authored-by: Bernadette Hammerle --- mob.go | 1 + mob_test.go | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/mob.go b/mob.go index 126bd27..bc3326e 100644 --- a/mob.go +++ b/mob.go @@ -971,6 +971,7 @@ func done(configuration config.Configuration) { } else { git("checkout", baseBranch.Name) git("branch", "-D", wipBranch.Name) + git("pull", "--ff-only") say.Info("someone else already ended your session") } } diff --git a/mob_test.go b/mob_test.go index d4f2449..b4871a4 100644 --- a/mob_test.go +++ b/mob_test.go @@ -1695,6 +1695,27 @@ func TestDoneSquashWipStartCommit(t *testing.T) { assertCommitsOnBranch(t, 1, "master") } +func TestDonePullsIfAlreadyDone(t *testing.T) { + _, configuration := setup(t) + configuration.NextStay = true + + setWorkingDir(tempDir + "/bob") + start(configuration) + createFile(t, "example.txt", "contentIrrelevant") + next(configuration) + + setWorkingDir(tempDir + "/alice") + start(configuration) + done(configuration) + git("commit", "-am", "\"mob done by Alice\"") + git("push") + + setWorkingDir(tempDir + "/bob") + done(configuration) + + assertFileExist(t, "example.txt") +} + func TestDoneNoSquashStartCommit(t *testing.T) { _, configuration := setup(t) configuration.NextStay = true