nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: remotemobprogramming/mob
Pull request #202 (2021-10-29 03:48:13)

Improve message when there is nothing to commit
This PR implements the feature requested in #197:

> Given there are no squashed changes made on a branch  
> When a user runs `mob done`  
> Then it should show an info message

<br>

**Demo:**

https://user-images.githubusercontent.com/2585460/139372391-a7063a7f-1d2d-4d04-a43f-b590d8272616.mp4

<br>

**Test Plan:**

It has been manually tested and unit tested.


seanpoulter: > Hm I’m wondering about this new line in the console output. I think we should remove that.

Yep. I missed `sayInfoIndented(getCachedChanges())`.


Patch:
diff --git a/mob.go b/mob.go
index c52a9de..08c4eb1 100644
--- a/mob.go
+++ b/mob.go
@@ -980,13 +980,21 @@ func done(configuration Configuration) {
 		git("branch", "-D", currentWipBranch.Name)
 		git("push", "--no-verify", configuration.RemoteName, "--delete", currentWipBranch.Name)
 
-		sayInfoIndented(getCachedChanges())
+		cachedChanges := getCachedChanges()
+		hasCachedChanges := len(cachedChanges) > 0
+		if hasCachedChanges {
+			sayInfoIndented(cachedChanges)
+		}
 		err := appendCoauthorsToSquashMsg(gitDir())
 		if err != nil {
 			sayError(err.Error())
 		}
 		if configuration.MobDoneSquash {
-			sayTodo("To finish, use", "git commit")
+			if isNothingToCommit() {
+				sayInfo("nothing was done, so nothing to commit")
+			} else {
+				sayTodo("To finish, use", "git commit")
+			}
 		}
 
 	} else {


Test patch:
diff --git a/mob_test.go b/mob_test.go
index a1b9088..98ae586 100644
--- a/mob_test.go
+++ b/mob_test.go
@@ -918,6 +918,17 @@ func TestDoneMerge(t *testing.T) {
 	assertOutputContains(t, output, "  git commit")
 }
 
+func TestDoneSquashNoChanges(t *testing.T) {
+	output, configuration := setup(t)
+	setWorkingDir(tempDir + "/local")
+	checkoutBranch("feature-something")
+
+	start(configuration)
+	done(configuration)
+
+	assertOutputContains(t, output, "nothing to commit")
+}
+
 func TestStartAndNextInSubdir(t *testing.T) {
 	_, configuration := setup(t)
Repository: remotemobprogramming/mob
Pull request #257 (2022-04-15 19:11:23)

Support both unquoted and quoted DoneSquash values in config file
With #256 it was possible to set the DoneSquash values via config file. However, this only worked for unquoted values. Now both unquoted and quoted values are supported.

The unquoted variant is still necessary for backwards compatibility when boolean values are assigned.

Signed-off-by: Thomas Much <github@snailshell.de>


Patch:
diff --git a/mob.go b/mob.go
index 278b98b..5fda40e 100644
--- a/mob.go
+++ b/mob.go
@@ -511,6 +511,14 @@ func setBoolean(s *bool, key string, value string) {
 }
 
 func setMobDoneSquash(configuration *Configuration, key string, value string) {
+	if strings.HasPrefix(value, "\"") {
+		unquotedValue, err := strconv.Unquote(value)
+		if err != nil {
+			sayWarning("Could not set key from configuration file because value is not parseable (" + key + "=" + value + ")")
+			return
+		}
+		value = unquotedValue
+	}
 	configuration.DoneSquash = doneSquash(value)
 	debugInfo("Overwriting " + key + " =" + string(configuration.DoneSquash))
 }


Test patch:
diff --git a/mob_test.go b/mob_test.go
index 31a0708..9889591 100644
--- a/mob_test.go
+++ b/mob_test.go
@@ -384,6 +384,16 @@ func TestReadConfigurationFromFileOverrideEverything(t *testing.T) {
 	equals(t, "Room\"\"_42", actualConfiguration1.TimerRoom)
 }
 
+func TestReadConfigurationFromFileWithNonBooleanQuotedDoneSquashValue(t *testing.T) {
+	Debug = true
+	tempDir = t.TempDir()
+	setWorkingDir(tempDir)
+
+	createFile(t, ".mob", "\nMOB_DONE_SQUASH=\"squash-wip\"")
+	actualConfiguration := parseUserConfiguration(getDefaultConfiguration(), tempDir+"/.mob")
+	equals(t, SquashWip, actualConfiguration.DoneSquash)
+}
+
 func TestReadConfigurationFromFileAndSkipBrokenLines(t *testing.T) {
 	Debug = true
 	tempDir = t.TempDir()
Repository: remotemobprogramming/mob
Pull request #269 (2022-05-13 14:44:21)

Open last modified file bug


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 30ce936..fac5647 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+# 3.1.4
+- Fixes a bug where mob saves the wrong filepath of the last modfied file in the wip commit message.
+
 # 3.1.3
 Just a version bump.
 
diff --git a/mob.go b/mob.go
index 81ea443..bc198c0 100644
--- a/mob.go
+++ b/mob.go
@@ -1334,10 +1334,10 @@ func createWipCommitMessage(configuration Configuration) string {
 
 // uses git status --short. To work properly files have to be staged.
 func getPathOfLastModifiedFile() string {
-	files := getModifiedFiles()
+	rootDir := gitRootDir()
+	files := getModifiedFiles(rootDir)
 	lastModifiedFilePath := ""
 	lastModifiedTime := time.Time{}
-	rootDir := gitRootDir()
 
 	debugInfo("Find last modified file")
 	if len(files) == 1 {
@@ -1366,9 +1366,12 @@ func getPathOfLastModifiedFile() string {
 }
 
 // uses git status --short. To work properly files have to be staged.
-func getModifiedFiles() []string {
+func getModifiedFiles(rootDir string) []string {
 	debugInfo("Find modified files")
+	oldWorkingDir := workingDir
+	workingDir = rootDir
 	gitstatus := silentgit("status", "--short")
+	workingDir = oldWorkingDir
 	lines := strings.Split(gitstatus, "\n")
 	files := []string{}
 	for _, line := range lines {


Test patch:
diff --git a/mob_test.go b/mob_test.go
index cf0d2af..3ab308b 100644
--- a/mob_test.go
+++ b/mob_test.go
@@ -786,6 +786,25 @@ func TestStartNextStay_WriteLastModifiedFileInCommit_WhenFileIsModified(t *testi
 	equals(t, silentgit("log", "--format=%B", "-n", "1", "HEAD"), configuration.WipCommitMessage+"\n\nlastFile:file1.txt")
 }
 
+func TestStartNextStay_WriteLastModifiedFileInCommit_WhenFileIsModifiedAndWorkingDirIsNotProjectRoot(t *testing.T) {
+	_, configuration := setup(t)
+	configuration.NextStay = true
+
+	start(configuration)
+	createFile(t, "file1.txt", "contentIrrelevant")
+	createFile(t, "file2.txt", "contentIrrelevant")
+	next(configuration)
+
+	start(configuration)
+	createDirectory(t, "dir")
+	createFile(t, "file1.txt", "contentIrrelevantButModified")
+	setWorkingDir(workingDir + "/dir")
+	next(configuration)
+
+	assertOnBranch(t, "mob-session")
+	equals(t, silentgit("log", "--format=%B", "-n", "1", "HEAD"), configuration.WipCommitMessage+"\n\nlastFile:file1.txt")
+}
+
 func TestStartNextStay_DoNotWriteLastModifiedFileInCommit_WhenFileIsDeleted(t *testing.T) {
 	_, configuration := setup(t)
 	configuration.NextStay = true
Repository: remotemobprogramming/mob
Pull request #283 (2022-06-26 15:01:34)

Show help output whenever any kind of help argument is given
As a naïve user (no remembering that the tool has only one help page) I expect to get some help for the `start` command (options that can be specified) when executing `mob start --help`. Instead, a mob session started requiring some manual clean-up from my part afterwards.

I would like to change the behavior in the way that whenever there is some help option in the command, the tool prints the help page.

simonharrer: Great idea. Can you add a changelog for the next patch version in the `changelog.md`? Otherwise, this looks good to me.

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fac5647..c579030 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+# 3.1.5
+- Print the help output whenever any kind of help argument (`help`, `--help`, `-h`) is present in the command, e.g. `mob s 10 -h`.
+
 # 3.1.4
 - Fixes a bug where mob saves the wrong filepath of the last modfied file in the wip commit message.
 
diff --git a/mob.go b/mob.go
index 4af7f74..6383d27 100644
--- a/mob.go
+++ b/mob.go
@@ -718,6 +718,10 @@ func parseArgs(args []string, configuration Configuration) (command string, para
 }
 
 func execute(command string, parameter []string, configuration Configuration) {
+	if helpRequested(parameter) {
+		help(configuration)
+		return
+	}
 
 	switch command {
 	case "s", "start":
@@ -781,6 +785,16 @@ func execute(command string, parameter []string, configuration Configuration) {
 	}
 }
 
+func helpRequested(parameter []string) bool {
+	for i := 0; i < len(parameter); i++ {
+		element := parameter[i]
+		if element == "help" || element == "--help" || element == "-h" {
+			return true
+		}
+	}
+	return false
+}
+
 func clean(configuration Configuration) {
 	git("fetch", configuration.RemoteName)
 


Test patch:
diff --git a/mob_test.go b/mob_test.go
index 3ab308b..46e1722 100644
--- a/mob_test.go
+++ b/mob_test.go
@@ -420,6 +420,16 @@ func TestExecuteInvalidCommandKicksOffHelp(t *testing.T) {
 	assertOutputContains(t, output, "Basic Commands:")
 }
 
+func TestExecuteAnyCommandWithHelpArgumentShowsHelpOutput(t *testing.T) {
+	output, _ := setup(t)
+
+	execute("s", []string{"10", "--help"}, getDefaultConfiguration())
+	assertOutputContains(t, output, "Basic Commands:")
+
+	execute("next", []string{"help"}, getDefaultConfiguration())
+	assertOutputContains(t, output, "Basic Commands:")
+}
+
 func TestStart(t *testing.T) {
 	_, configuration := setup(t)
 
@@ -1481,6 +1491,14 @@ func TestSetMobDoneSquashEmptyStringValue(t *testing.T) {
 	equals(t, Squash, configuration.DoneSquash)
 }
 
+func TestHelpRequested(t *testing.T) {
+	equals(t, false, helpRequested([]string{""}))
+	equals(t, false, helpRequested([]string{"a", "mob", "21"}))
+	equals(t, true, helpRequested([]string{"--help"}))
+	equals(t, true, helpRequested([]string{"a", "help", "12"}))
+	equals(t, true, helpRequested([]string{"s", "10", "-h"}))
+}
+
 func gitStatus() GitStatus {
 	shortStatus := silentgit("status", "--short")
 	statusLines := strings.Split(shortStatus, "\n")
Repository: remotemobprogramming/mob
Pull request #319 (2022-09-26 12:04:39)

fix gitRootDir() to allow usage of symlinked .git folder
Hello, this PR fixes issue #302 .

Don't hesitate to give your feedback if you think I should change something!



Patch:
diff --git a/mob.go b/mob.go
index 1c7c108..d9b7ec3 100644
--- a/mob.go
+++ b/mob.go
@@ -1576,7 +1576,7 @@ func gitDir() string {
 }
 
 func gitRootDir() string {
-	return strings.TrimSuffix(gitDir(), "/.git")
+	return silentgit("rev-parse", "--show-toplevel")
 }
 
 func squashOrCommit(configuration Configuration) string {


Test patch:
diff --git a/create-testbed b/create-testbed
index 5980c75..3a22083 100755
--- a/create-testbed
+++ b/create-testbed
@@ -27,6 +27,24 @@ clonerepo() {
     (cd "${dir}" && git config --local user.email "${name}@example.com")
 }
 
+clonerepowithsymlink() {
+  dir="$1"
+  gitdir="$2"
+  clonerepo "${dir}"
+  echo ""
+  echo "clonerepowithsymlink: move .git to ${gitdir} and create symlink to it"
+  mv "${dir}/.git" "$2"
+  ln -s "${gitdir}" "${dir}/.git"
+}
+
+cleanrepowithsymlink() {
+  dir="$1"
+  gitdir="$2"
+  echo ""
+  echo "cleanrepowithsymlink: Delete ${dir} and ${gitdir}"
+  rm -rf "${dir}" "${gitdir}"
+}
+
 tmpdir=$1
 localdir="${tmpdir}/local"
 remotedir="${tmpdir}/remote"
@@ -69,5 +87,10 @@ do
     echo "Created non-git dir ${dir}"
 done
 
+echo "Creating local repo with .git symlink"
+localsymlink="${tmpdir}/local-symlink"
+localsymlink_gitdir="${tmpdir}/local-symlink.git"
+cleanrepowithsymlink "${localsymlink}" "${localsymlink_gitdir}"
+clonerepowithsymlink "${localsymlink}" "${localsymlink_gitdir}"
 
 echo "Done."
diff --git a/mob_test.go b/mob_test.go
index 91f770f..f4c8ce5 100644
--- a/mob_test.go
+++ b/mob_test.go
@@ -1097,6 +1097,11 @@ func TestTestbed(t *testing.T) {
 	createFile(t, "file4.txt", "zcvx")
 	next(configuration)
 
+	setWorkingDir(tempDir + "/local-symlink")
+	start(configuration)
+	createFile(t, "file5.txt", "uiop")
+	next(configuration)
+
 	setWorkingDir(tempDir + "/local")
 	start(configuration)
 
@@ -1105,6 +1110,7 @@ func TestTestbed(t *testing.T) {
 	assertOutputContains(t, &output, "localother")
 	assertOutputContains(t, &output, "alice")
 	assertOutputContains(t, &output, "bob")
+	assertOutputContains(t, &output, "local-symlink")
 }
 
 func TestStartDoneWithMobDoneSquash(t *testing.T) {
@@ -1449,6 +1455,14 @@ func TestGitRootDir(t *testing.T) {
 	equals(t, expectedPath, gitRootDir())
 }
 
+func TestGitRootDirWithSymbolicLink(t *testing.T) {
+	setup(t)
+	symlinkDir := tempDir + "/local-symlink"
+	setWorkingDir(symlinkDir)
+	expectedLocalSymlinkPath, _ := filepath.EvalSymlinks(symlinkDir)
+	equals(t, expectedLocalSymlinkPath, gitRootDir())
+}
+
 func TestBothCreateNonemptyCommitWithNext(t *testing.T) {
 	_, configuration := setup(t)
Repository: remotemobprogramming/mob
Pull request #373 (2023-03-29 22:11:45)

Directly specify remote ref when pushing.
Users who have the Git config push.default=tracking, or other values, will have different default behavior on 'git push'.

Example: a newly created mob branch from `origin/mainline` is tracking `origin/mainline` until `--set-upstream` takes effect. The original `git push`, which is intended to push to `origin/mob/mainline`, will actually push the `mob start` commit to `origin/mainline` if `push.default=tracking`.

To avoid this scenario, we will always specify the remote ref we are pushing to.

jakemcc: :+1: to getting this change landed. We just spent the morning trying to figure out why `mob` kept pushing the newly created branch on top of `origin/master` and it came down to having `push.default = tracking`.
gregorriegler: Hi @jstoneham, sorry for my late reply.
This is a nice find and I look forward to merge your PR to fix it.
Would you be able to write a test for the behavior you expected but didn't occur?
jstoneham: I'll try. Sorry to report I'm on vacation at the moment but if I find some time!
gregorriegler: Oh! Enjoy your vacation 😃. No rush!

Patch:
diff --git a/mob.go b/mob.go
index d0c3746..0dd4739 100644
--- a/mob.go
+++ b/mob.go
@@ -1007,7 +1007,7 @@ func startNewMobSession(configuration config.Configuration) {
 	say.Info("starting new session from " + currentBaseBranch.remote(configuration).String())
 	git("checkout", "-B", currentWipBranch.Name, currentBaseBranch.remote(configuration).Name)
 	git("commit", "--allow-empty", "-m", configuration.StartCommitMessage)
-	gitPush(gitHooksOption(configuration), "--set-upstream", configuration.RemoteName, currentWipBranch.Name)
+	gitPush(gitHooksOption(configuration), "--set-upstream", configuration.RemoteName, currentWipBranch.Name + ":" + currentWipBranch.Name)
 }
 
 func gitPush(args ...string) {


Test patch:
diff --git a/mob_test.go b/mob_test.go
index aad223f..be71de0 100644
--- a/mob_test.go
+++ b/mob_test.go
@@ -387,6 +387,16 @@ func TestStartNextWithBranchContainingHyphen(t *testing.T) {
 	next(configuration)
 }
 
+func TestStartWithPushDefaultTracking(t *testing.T) {
+	_, configuration := setup(t)
+	createFileAndCommitIt(t, "example.txt", "asdf", "asdf")
+	git("push", "origin", "master")
+	git("config", "push.default", "tracking")
+
+	start(configuration)
+	assertMobSessionBranches(t, configuration, "mob-session")
+}
+
 func TestReset(t *testing.T) {
 	output, configuration := setup(t)
Repository: goadesign/goa
Pull request #2296 (2019-09-27 10:01:11)

Properly inherit params and payload attributes to child services
This is backport of #2283 to v3.

raphael: Thank you!

Patch:
diff --git a/dsl/http.go b/dsl/http.go
index d51fe16a..2611b262 100644
--- a/dsl/http.go
+++ b/dsl/http.go
@@ -699,6 +699,10 @@ func Body(args ...interface{}) {
 // Parent sets the name of the parent service. The parent service canonical
 // method path is used as prefix for all the service HTTP endpoint paths.
 //
+// Attributes of the parent method payload that map to parent path parameters
+// are automatically merged into the child method payload type if not already
+// defined.
+//
 // Parent must appear in a Service expression.
 //
 // Parent accepts one argument: the name of the parent service.
diff --git a/expr/http_endpoint.go b/expr/http_endpoint.go
index 9040bfe1..d74f9b34 100644
--- a/expr/http_endpoint.go
+++ b/expr/http_endpoint.go
@@ -176,7 +176,19 @@ func (e *HTTPEndpointExpr) Prepare() {
 		if c := p.CanonicalEndpoint(); c != nil {
 			if !e.HasAbsoluteRoutes() {
 				headers.Merge(c.Headers)
-				params.Merge(c.Params)
+				params.Merge(c.PathParams())
+
+				// Inherit attributes for path params from parent service
+				WalkMappedAttr(c.PathParams(), func(name, _ string, _ *AttributeExpr) error {
+					if att := c.MethodExpr.Payload.Find(name); att != nil {
+						if o := AsObject(e.MethodExpr.Payload.Type); o != nil {
+							if o.Attribute(name) == nil {
+								o.Set(name, att)
+							}
+						}
+					}
+					return nil
+				})
 			}
 		}
 	}


Test patch:
diff --git a/expr/http_endpoint_test.go b/expr/http_endpoint_test.go
index 71d9bc27..f89afc6c 100644
--- a/expr/http_endpoint_test.go
+++ b/expr/http_endpoint_test.go
@@ -60,6 +60,9 @@ func TestHTTPEndpointValidation(t *testing.T) {
 		"endpoint-missing-token-extend": {
 			DSL: testdata.EndpointExtendToken,
 		},
+		"endpoint-has-parent": {
+			DSL: testdata.EndpointHasParent,
+		},
 	}
 	for name, c := range cases {
 		t.Run(name, func(t *testing.T) {
diff --git a/expr/testdata/endpoint_dsls.go b/expr/testdata/endpoint_dsls.go
index ec63beac..99f848f2 100644
--- a/expr/testdata/endpoint_dsls.go
+++ b/expr/testdata/endpoint_dsls.go
@@ -150,6 +150,39 @@ var EndpointExtendToken = func() {
 	})
 }
 
+var EndpointHasParent = func() {
+	Service("Parent", func() {
+		HTTP(func() {
+			Path("/parents")
+			CanonicalMethod("Method")
+		})
+		Method("Method", func() {
+			Payload(func() {
+				Attribute("parent_id", Int)
+				Attribute("query_1", String)
+			})
+			HTTP(func() {
+				GET("/{parent_id}")
+				Param("query_1")
+			})
+		})
+	})
+	Service("Child", func() {
+		HTTP(func() {
+			Path("/children")
+			Parent("Parent")
+		})
+		Method("Method", func() {
+			Payload(func() {
+				Attribute("child_id", Int)
+			})
+			HTTP(func() {
+				GET("/{child_id}")
+			})
+		})
+	})
+}
+
 var FinalizeEndpointBodyAsExtendedTypeDSL = func() {
 	var EntityData = Type("EntityData", func() {
 		Attribute("name", String)
Repository: pion/dtls
Pull request #461 (2022-05-10 17:07:29)

Don't attempt to append zero length fragments
Before the fragmentBuffer would process zero length fragments. Since
they are zero length the append would not do anything. This would
result in an infinite loop.



Patch:
diff --git a/fragment_buffer.go b/fragment_buffer.go
index 0274993..8a00ee7 100644
--- a/fragment_buffer.go
+++ b/fragment_buffer.go
@@ -76,7 +76,7 @@ func (f *fragmentBuffer) pop() (content []byte, epoch uint16) {
 		for _, f := range frags {
 			if f.handshakeHeader.FragmentOffset == targetOffset {
 				fragmentEnd := (f.handshakeHeader.FragmentOffset + f.handshakeHeader.FragmentLength)
-				if fragmentEnd != f.handshakeHeader.Length {
+				if fragmentEnd != f.handshakeHeader.Length && f.handshakeHeader.FragmentLength != 0 {
 					if !appendMessage(fragmentEnd) {
 						return false
 					}


Test patch:
diff --git a/fragment_buffer_test.go b/fragment_buffer_test.go
index 62c7ead..0f49c75 100644
--- a/fragment_buffer_test.go
+++ b/fragment_buffer_test.go
@@ -73,6 +73,20 @@ func TestFragmentBuffer(t *testing.T) {
 			},
 			Epoch: 0,
 		},
+		// Assert that a zero length fragment doesn't cause the fragmentBuffer to enter an infinite loop
+		{
+			Name: "Zero Length Fragment",
+			In: [][]byte{
+				{
+					0x16, 0xfe, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00,
+					0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+				},
+			},
+			Expected: [][]byte{
+				{0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00},
+			},
+			Epoch: 0,
+		},
 	} {
 		fragmentBuffer := newFragmentBuffer()
 		for _, frag := range test.In {