diff --git a/CHANGELOG.md b/CHANGELOG.md index 11f4f048..ee7374e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 5.0.1 +- Fix: The configuration option `MOB_SKIP_CI_PUSH_OPTION_ENABLED` now works correctly + +Thank you @stefanscheidt for reporting this issue + # 5.0.0 - Feature: You can now set goals - Feature: Can make use of the git push-option "ci.skip" diff --git a/README.md b/README.md index d46ec6b2..0373baf8 100644 --- a/README.md +++ b/README.md @@ -383,6 +383,7 @@ MOB_CLI_NAME="mob" MOB_REMOTE_NAME="origin" MOB_WIP_COMMIT_MESSAGE="mob next [ci-skip] [ci skip] [skip ci]" MOB_START_COMMIT_MESSAGE="mob start [ci-skip] [ci skip] [skip ci]" +MOB_SKIP_CI_PUSH_OPTION_ENABLED=true MOB_GIT_HOOKS_ENABLED=false MOB_REQUIRE_COMMIT_MESSAGE=false MOB_VOICE_COMMAND="say \"%s\"" diff --git a/coauthors.go b/coauthors.go index 5cb331c4..df55042c 100644 --- a/coauthors.go +++ b/coauthors.go @@ -3,7 +3,7 @@ package main import ( "bufio" "fmt" - "github.com/remotemobprogramming/mob/v4/say" + "github.com/remotemobprogramming/mob/v5/say" "os" "path" "regexp" diff --git a/configuration/configuration.go b/configuration/configuration.go index 27535951..4c10f790 100644 --- a/configuration/configuration.go +++ b/configuration/configuration.go @@ -2,7 +2,7 @@ package configuration import ( "bufio" - "github.com/remotemobprogramming/mob/v4/say" + "github.com/remotemobprogramming/mob/v5/say" "os" "runtime" "strconv" diff --git a/configuration/configuration_test.go b/configuration/configuration_test.go index e11e5590..844aec0d 100644 --- a/configuration/configuration_test.go +++ b/configuration/configuration_test.go @@ -2,8 +2,8 @@ package configuration import ( "fmt" - "github.com/remotemobprogramming/mob/v4/say" - "github.com/remotemobprogramming/mob/v4/test" + "github.com/remotemobprogramming/mob/v5/say" + "github.com/remotemobprogramming/mob/v5/test" "os" "strings" "testing" diff --git a/go.mod b/go.mod index 86919c2d..06ee896c 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module github.com/remotemobprogramming/mob/v4 +module github.com/remotemobprogramming/mob/v5 go 1.22 diff --git a/goal/goal.go b/goal/goal.go index f732796e..5ee06570 100644 --- a/goal/goal.go +++ b/goal/goal.go @@ -4,9 +4,9 @@ import ( "encoding/json" "errors" "fmt" - config "github.com/remotemobprogramming/mob/v4/configuration" - "github.com/remotemobprogramming/mob/v4/httpclient" - "github.com/remotemobprogramming/mob/v4/say" + config "github.com/remotemobprogramming/mob/v5/configuration" + "github.com/remotemobprogramming/mob/v5/httpclient" + "github.com/remotemobprogramming/mob/v5/say" "io" "os" "strings" diff --git a/help/help.go b/help/help.go index c65eed6d..2b6c0490 100644 --- a/help/help.go +++ b/help/help.go @@ -1,8 +1,8 @@ package help import ( - config "github.com/remotemobprogramming/mob/v4/configuration" - "github.com/remotemobprogramming/mob/v4/say" + config "github.com/remotemobprogramming/mob/v5/configuration" + "github.com/remotemobprogramming/mob/v5/say" ) func Help(configuration config.Configuration) { diff --git a/httpclient/httpclient.go b/httpclient/httpclient.go index 314ccb04..1211eb80 100644 --- a/httpclient/httpclient.go +++ b/httpclient/httpclient.go @@ -6,7 +6,7 @@ import ( "crypto/x509" "errors" "fmt" - "github.com/remotemobprogramming/mob/v4/say" + "github.com/remotemobprogramming/mob/v5/say" "io/ioutil" "net/http" "net/url" diff --git a/mob.go b/mob.go index 579e1450..38346147 100644 --- a/mob.go +++ b/mob.go @@ -4,11 +4,11 @@ import ( "bufio" "errors" "fmt" - config "github.com/remotemobprogramming/mob/v4/configuration" - "github.com/remotemobprogramming/mob/v4/goal" - "github.com/remotemobprogramming/mob/v4/help" - "github.com/remotemobprogramming/mob/v4/open" - "github.com/remotemobprogramming/mob/v4/say" + config "github.com/remotemobprogramming/mob/v5/configuration" + "github.com/remotemobprogramming/mob/v5/goal" + "github.com/remotemobprogramming/mob/v5/help" + "github.com/remotemobprogramming/mob/v5/open" + "github.com/remotemobprogramming/mob/v5/say" "os" "os/exec" "path/filepath" @@ -21,7 +21,7 @@ import ( ) const ( - versionNumber = "5.0.0" + versionNumber = "5.0.1" minimumGitVersion = "2.13.0" ) @@ -755,11 +755,10 @@ func startNewMobSession(configuration config.Configuration) { func gitPushArgs(c config.Configuration) []string { pushArgs := []string{"push"} - if c.SkipCiPushOptionEnabled { + if !c.SkipCiPushOptionEnabled { return pushArgs - } else { - return append(pushArgs, "--push-option", "ci.skip") } + return append(pushArgs, "--push-option", "ci.skip") } func getUntrackedFiles() string { @@ -1153,9 +1152,14 @@ func git(args ...string) { if !isGit() { say.Error("expecting the current working directory to be a git repository.") } else { - say.Error(commandString) - say.Error(output) - say.Error(err.Error()) + if strings.Contains(output, "does not support push options") { + say.Error("The receiving end does not support push options") + say.Fix("Disable the push option ci.skip in your .mob file or set the expected environment variable", "export MOB_SKIP_CI_PUSH_OPTION_ENABLED=false") + } else { + say.Error(commandString) + say.Error(output) + say.Error(err.Error()) + } } Exit(1) } diff --git a/mob_test.go b/mob_test.go index 9505755d..0252dd6a 100644 --- a/mob_test.go +++ b/mob_test.go @@ -2,9 +2,9 @@ package main import ( "fmt" - config "github.com/remotemobprogramming/mob/v4/configuration" - "github.com/remotemobprogramming/mob/v4/open" - "github.com/remotemobprogramming/mob/v4/say" + config "github.com/remotemobprogramming/mob/v5/configuration" + "github.com/remotemobprogramming/mob/v5/open" + "github.com/remotemobprogramming/mob/v5/say" "os" "path/filepath" "reflect" @@ -152,8 +152,8 @@ func TestNextNotMobProgramming(t *testing.T) { } func TestRequireCommitMessage(t *testing.T) { - output, _ := setup(t) - configuration := config.GetDefaultConfiguration() + output, configuration := setup(t) + configuration.NextStay = true configuration.RequireCommitMessage = true start(configuration) @@ -216,13 +216,29 @@ func TestStartDespiteGitHook(t *testing.T) { } func TestStartWithCISkip(t *testing.T) { - _, configuration := setup(t) + output, configuration := setup(t) + configuration.SkipCiPushOptionEnabled = true + mockExit() + + start(configuration) + + assertOutputContains(t, output, "git push --push-option ci.skip --no-verify --set-upstream origin mob-session:mob-session") + assertOutputContains(t, output, "Disable the push option ci.skip in your .mob file or set the expected environment variable") + assertOutputContains(t, output, "export MOB_SKIP_CI_PUSH_OPTION_ENABLED=false") + resetExit() +} + +func TestStartWithOutCISkip(t *testing.T) { + output, configuration := setup(t) + configuration.SkipCiPushOptionEnabled = false start(configuration) assertOnBranch(t, "mob-session") assertMobSessionBranches(t, configuration, "mob-session") assertCommitLogNotContainsMessage(t, "mob-session", configuration.StartCommitMessage) + assertOutputNotContains(t, output, "--push-option ci.skip") + } func TestStartWithMultipleExistingBranches(t *testing.T) { @@ -1901,6 +1917,8 @@ func gitStatus() GitStatus { func setup(t *testing.T) (output *string, configuration config.Configuration) { configuration = config.GetDefaultConfiguration() + // Test setup does not support push options + configuration.SkipCiPushOptionEnabled = false configuration.NextStay = false createTestbed(t, configuration) assertOnBranch(t, "master") diff --git a/squash_wip.go b/squash_wip.go index cfcb6645..6bd297e6 100644 --- a/squash_wip.go +++ b/squash_wip.go @@ -1,8 +1,8 @@ package main import ( - config "github.com/remotemobprogramming/mob/v4/configuration" - "github.com/remotemobprogramming/mob/v4/say" + config "github.com/remotemobprogramming/mob/v5/configuration" + "github.com/remotemobprogramming/mob/v5/say" "io" "os" "path/filepath" diff --git a/squash_wip_test.go b/squash_wip_test.go index d9eda2cc..1505349c 100644 --- a/squash_wip_test.go +++ b/squash_wip_test.go @@ -2,7 +2,7 @@ package main import ( "fmt" - config "github.com/remotemobprogramming/mob/v4/configuration" + config "github.com/remotemobprogramming/mob/v5/configuration" "os" "strings" "testing" diff --git a/status.go b/status.go index 413fe980..924cf829 100644 --- a/status.go +++ b/status.go @@ -1,8 +1,8 @@ package main import ( - config "github.com/remotemobprogramming/mob/v4/configuration" - "github.com/remotemobprogramming/mob/v4/say" + config "github.com/remotemobprogramming/mob/v5/configuration" + "github.com/remotemobprogramming/mob/v5/say" ) func status(configuration config.Configuration) { diff --git a/status_test.go b/status_test.go index 9f76f1a1..8c1ed7ef 100644 --- a/status_test.go +++ b/status_test.go @@ -1,7 +1,7 @@ package main import ( - config "github.com/remotemobprogramming/mob/v4/configuration" + config "github.com/remotemobprogramming/mob/v5/configuration" "strconv" "testing" ) diff --git a/test/test.go b/test/test.go index 0e4f036a..9a724ec2 100644 --- a/test/test.go +++ b/test/test.go @@ -2,7 +2,7 @@ package test import ( "fmt" - "github.com/remotemobprogramming/mob/v4/say" + "github.com/remotemobprogramming/mob/v5/say" "os" "path/filepath" "reflect" diff --git a/timer.go b/timer.go index 37310a90..2650d325 100644 --- a/timer.go +++ b/timer.go @@ -4,9 +4,9 @@ import ( "encoding/json" "errors" "fmt" - config "github.com/remotemobprogramming/mob/v4/configuration" - "github.com/remotemobprogramming/mob/v4/httpclient" - "github.com/remotemobprogramming/mob/v4/say" + config "github.com/remotemobprogramming/mob/v5/configuration" + "github.com/remotemobprogramming/mob/v5/httpclient" + "github.com/remotemobprogramming/mob/v5/say" "runtime" "strconv" "time"