nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: libgit2/git2go
Pull request #768 (2021-04-04 15:04:30)

Git repository item path (#757)
add wrapper for `git_repository_item_path`

(cherry picked from commit a4d202ed7b025331ee4a63ebc38f62519cee4750)


Patch:
diff --git a/repository.go b/repository.go
index 1ee9b36..c17b4f4 100644
--- a/repository.go
+++ b/repository.go
@@ -735,3 +735,37 @@ func (r *Repository) RemoveMessage() error {
 	}
 	return nil
 }
+
+type RepositoryItem int
+
+const (
+	RepositoryItemGitDir     RepositoryItem = C.GIT_REPOSITORY_ITEM_GITDIR
+	RepositoryItemWorkDir    RepositoryItem = C.GIT_REPOSITORY_ITEM_WORKDIR
+	RepositoryItemCommonDir  RepositoryItem = C.GIT_REPOSITORY_ITEM_COMMONDIR
+	RepositoryItemIndex      RepositoryItem = C.GIT_REPOSITORY_ITEM_INDEX
+	RepositoryItemObjects    RepositoryItem = C.GIT_REPOSITORY_ITEM_OBJECTS
+	RepositoryItemRefs       RepositoryItem = C.GIT_REPOSITORY_ITEM_REFS
+	RepositoryItemPackedRefs RepositoryItem = C.GIT_REPOSITORY_ITEM_PACKED_REFS
+	RepositoryItemRemotes    RepositoryItem = C.GIT_REPOSITORY_ITEM_REMOTES
+	RepositoryItemConfig     RepositoryItem = C.GIT_REPOSITORY_ITEM_CONFIG
+	RepositoryItemInfo       RepositoryItem = C.GIT_REPOSITORY_ITEM_INFO
+	RepositoryItemHooks      RepositoryItem = C.GIT_REPOSITORY_ITEM_HOOKS
+	RepositoryItemLogs       RepositoryItem = C.GIT_REPOSITORY_ITEM_LOGS
+	RepositoryItemModules    RepositoryItem = C.GIT_REPOSITORY_ITEM_MODULES
+	RepositoryItemWorkTrees  RepositoryItem = C.GIT_REPOSITORY_ITEM_WORKTREES
+)
+
+func (r *Repository) ItemPath(item RepositoryItem) (string, error) {
+	var c_buf C.git_buf
+	defer C.git_buf_free(&c_buf)
+
+	runtime.LockOSThread()
+	defer runtime.UnlockOSThread()
+
+	ret := C.git_repository_item_path(&c_buf, r.ptr, C.git_repository_item_t(item))
+	runtime.KeepAlive(r)
+	if ret < 0 {
+		return "", MakeGitError(ret)
+	}
+	return C.GoString(c_buf.ptr), nil
+}


Test patch:
diff --git a/repository_test.go b/repository_test.go
index 5a0f920..e403aa9 100644
--- a/repository_test.go
+++ b/repository_test.go
@@ -92,3 +92,14 @@ func TestRepositorySetConfig(t *testing.T) {
 		t.Fatal("result must be true")
 	}
 }
+
+func TestRepositoryItemPath(t *testing.T) {
+	repo := createTestRepo(t)
+	defer cleanupTestRepo(t, repo)
+
+	gitDir, err := repo.ItemPath(RepositoryItemGitDir)
+	checkFatal(t, err)
+	if gitDir == "" {
+		t.Error("expected not empty gitDir")
+	}
+}
Repository: libgit2/git2go
Pull request #847 (2021-10-23 17:33:29)

bugfix:  HTTPS Clone fails with remote pointer not found using Go transport (#836) (#842)
Fixes: #836

Changes:

* adding a weak bool param for Remote
* create a new remote in the smartTransportCallback incase one is not found

(cherry picked from commit 0e8009f00a65034d196c67b1cdd82af6f12c34d3)


Patch:
diff --git a/remote.go b/remote.go
index ada3a87..b907683 100644
--- a/remote.go
+++ b/remote.go
@@ -182,6 +182,9 @@ type Remote struct {
 	ptr       *C.git_remote
 	callbacks RemoteCallbacks
 	repo      *Repository
+	// weak indicates that a remote is a weak pointer and should not be
+	// freed.
+	weak bool
 }
 
 type remotePointerList struct {
@@ -592,6 +595,9 @@ func (r *Remote) free() {
 // Free releases the resources of the Remote.
 func (r *Remote) Free() {
 	r.repo.Remotes.untrackRemote(r)
+	if r.weak {
+		return
+	}
 	r.free()
 }
 
@@ -1221,3 +1227,12 @@ func freeRemoteCreateOptions(ptr *C.git_remote_create_options) {
 	C.free(unsafe.Pointer(ptr.name))
 	C.free(unsafe.Pointer(ptr.fetchspec))
 }
+
+// createNewEmptyRemote used to get a new empty object of *Remote
+func createNewEmptyRemote() *Remote {
+	return &Remote{
+		callbacks: RemoteCallbacks{},
+		repo:      nil,
+		weak:      false,
+	}
+}
diff --git a/transport.go b/transport.go
index cf43acc..b060dc3 100644
--- a/transport.go
+++ b/transport.go
@@ -22,7 +22,6 @@ void _go_git_setup_smart_subtransport_stream(_go_managed_smart_subtransport_stre
 */
 import "C"
 import (
-	"errors"
 	"fmt"
 	"io"
 	"reflect"
@@ -296,8 +295,10 @@ func smartTransportCallback(
 	registeredSmartTransport := pointerHandles.Get(handle).(*RegisteredSmartTransport)
 	remote, ok := remotePointers.get(owner)
 	if !ok {
-		err := errors.New("remote pointer not found")
-		return setCallbackError(errorMessage, err)
+		// create a new empty remote and set it
+		// as a weak pointer, so that control stays in golang
+		remote = createNewEmptyRemote()
+		remote.weak = true
 	}
 
 	managed := &managedSmartSubtransport{


Test patch:
diff --git a/clone_test.go b/clone_test.go
index acfbbcb..bcf7055 100644
--- a/clone_test.go
+++ b/clone_test.go
@@ -2,6 +2,7 @@ package git
 
 import (
 	"io/ioutil"
+	"os"
 	"testing"
 )
 
@@ -76,3 +77,17 @@ func TestCloneWithCallback(t *testing.T) {
 	}
 	defer remote.Free()
 }
+
+// TestCloneWithExternalHTTPUrl
+func TestCloneWithExternalHTTPUrl(t *testing.T) {
+
+	path, err := ioutil.TempDir("", "git2go")
+	defer os.RemoveAll(path)
+
+	// clone the repo
+	url := "https://github.com/libgit2/TestGitRepository"
+	_, err = Clone(url, path, &CloneOptions{})
+	if err != nil {
+		t.Fatal("cannot clone remote repo via https, error: ", err)
+	}
+}
Repository: libgit2/git2go
Pull request #872 (2021-12-22 16:04:18)

Add ability to specify ProxyOptions for push operations
Analog to https://github.com/libgit2/git2go/pull/623 but for push operations rather than fetch.


Patch:
diff --git a/remote.go b/remote.go
index f4424fc..cde92b9 100644
--- a/remote.go
+++ b/remote.go
@@ -291,6 +291,9 @@ type PushOptions struct {
 
 	// Headers are extra headers for the push operation.
 	Headers []string
+
+	// Proxy options to use for this push operation
+	ProxyOptions ProxyOptions
 }
 
 type RemoteHead struct {
@@ -1001,6 +1004,7 @@ func populatePushOptions(copts *C.git_push_options, opts *PushOptions, errorTarg
 		strings: makeCStringsFromStrings(opts.Headers),
 	}
 	populateRemoteCallbacks(&copts.callbacks, &opts.RemoteCallbacks, errorTarget)
+	populateProxyOptions(&copts.proxy_opts, &opts.ProxyOptions)
 	return copts
 }
 
@@ -1010,6 +1014,7 @@ func freePushOptions(copts *C.git_push_options) {
 	}
 	untrackCallbacksPayload(&copts.callbacks)
 	freeStrarray(&copts.custom_headers)
+	freeProxyOptions(&copts.proxy_opts)
 }
 
 // Fetch performs a fetch operation. refspecs specifies which refspecs
diff --git a/settings.go b/settings.go
index 9325618..7f9b5b1 100644
--- a/settings.go
+++ b/settings.go
@@ -101,6 +101,14 @@ func EnableStrictHashVerification(enabled bool) error {
 	}
 }
 
+func EnableFsyncGitDir(enabled bool) error {
+	if enabled {
+		return setSizet(C.GIT_OPT_ENABLE_FSYNC_GITDIR, 1)
+	} else {
+		return setSizet(C.GIT_OPT_ENABLE_FSYNC_GITDIR, 0)
+	}
+}
+
 func CachedMemory() (current int, allowed int, err error) {
 	return getSizetSizet(C.GIT_OPT_GET_CACHED_MEMORY)
 }


Test patch:
diff --git a/settings_test.go b/settings_test.go
index 47eb711..e3761d4 100644
--- a/settings_test.go
+++ b/settings_test.go
@@ -65,6 +65,14 @@ func TestEnableStrictHashVerification(t *testing.T) {
 	checkFatal(t, err)
 }
 
+func TestEnableFsyncGitDir(t *testing.T) {
+	err := EnableFsyncGitDir(false)
+	checkFatal(t, err)
+
+	err = EnableFsyncGitDir(true)
+	checkFatal(t, err)
+}
+
 func TestCachedMemory(t *testing.T) {
 	current, allowed, err := CachedMemory()
 	checkFatal(t, err)
Repository: libgit2/git2go
Pull request #875 (2022-01-18 02:51:54)

Add EnableFsyncGitDir to enable synchronized writes to the gitdir (#874)
This adds support for the GIT_OPT_ENABLE_FSYNC_GITDIR option in libgit2.

Co-authored-by: James Fargher <jfargher@gitlab.com>
(cherry picked from commit 1fcc9d87430e41cc333ce5b2431df7058e03bbb7)


Patch:
diff --git a/settings.go b/settings.go
index 9325618..7f9b5b1 100644
--- a/settings.go
+++ b/settings.go
@@ -101,6 +101,14 @@ func EnableStrictHashVerification(enabled bool) error {
 	}
 }
 
+func EnableFsyncGitDir(enabled bool) error {
+	if enabled {
+		return setSizet(C.GIT_OPT_ENABLE_FSYNC_GITDIR, 1)
+	} else {
+		return setSizet(C.GIT_OPT_ENABLE_FSYNC_GITDIR, 0)
+	}
+}
+
 func CachedMemory() (current int, allowed int, err error) {
 	return getSizetSizet(C.GIT_OPT_GET_CACHED_MEMORY)
 }


Test patch:
diff --git a/settings_test.go b/settings_test.go
index 47eb711..e3761d4 100644
--- a/settings_test.go
+++ b/settings_test.go
@@ -65,6 +65,14 @@ func TestEnableStrictHashVerification(t *testing.T) {
 	checkFatal(t, err)
 }
 
+func TestEnableFsyncGitDir(t *testing.T) {
+	err := EnableFsyncGitDir(false)
+	checkFatal(t, err)
+
+	err = EnableFsyncGitDir(true)
+	checkFatal(t, err)
+}
+
 func TestCachedMemory(t *testing.T) {
 	current, allowed, err := CachedMemory()
 	checkFatal(t, err)
Repository: markus-wa/demoinfocs-golang
Pull request #423 (2023-09-28 17:25:00)

fix: possible panic hostage.Leader() with CS2 demos
- Fix panic when calling `hostage.Leader()` with CS2 demos
- Add `IsGrabbingHostage` to `Player`

Thx!


Patch:
diff --git a/pkg/demoinfocs/common/hostage.go b/pkg/demoinfocs/common/hostage.go
index d407a2a..123227c 100644
--- a/pkg/demoinfocs/common/hostage.go
+++ b/pkg/demoinfocs/common/hostage.go
@@ -53,6 +53,10 @@ func (hostage *Hostage) Health() int {
 // Leader returns the possible player leading the hostage.
 // Returns nil if the hostage is not following a player.
 func (hostage *Hostage) Leader() *Player {
+	if hostage.demoInfoProvider.IsSource2() {
+		return hostage.demoInfoProvider.FindPlayerByPawnHandle(getUInt64(hostage.Entity, "m_leader"))
+	}
+
 	return hostage.demoInfoProvider.FindPlayerByHandle(getInt(hostage.Entity, "m_leader"))
 }
 
diff --git a/pkg/demoinfocs/common/player.go b/pkg/demoinfocs/common/player.go
index 29ba23d..e8a0a1e 100644
--- a/pkg/demoinfocs/common/player.go
+++ b/pkg/demoinfocs/common/player.go
@@ -774,6 +774,15 @@ func (p *Player) LastPlaceName() string {
 	return getString(p.Entity, "m_szLastPlaceName")
 }
 
+// IsGrabbingHostage returns true if the player is currently grabbing a hostage.
+func (p *Player) IsGrabbingHostage() bool {
+	if p.demoInfoProvider.IsSource2() {
+		return getBool(p.PlayerPawnEntity(), "m_bIsGrabbingHostage")
+	}
+
+	return getBool(p.Entity, "m_bIsGrabbingHostage")
+}
+
 type demoInfoProvider interface {
 	IngameTick() int   // current in-game tick, used for IsBlinded()
 	TickRate() float64 // in-game tick rate, used for Player.IsBlinded()


Test patch:
diff --git a/pkg/demoinfocs/common/player_test.go b/pkg/demoinfocs/common/player_test.go
index 0db2f1e..a9e2f39 100644
--- a/pkg/demoinfocs/common/player_test.go
+++ b/pkg/demoinfocs/common/player_test.go
@@ -580,6 +580,18 @@ func TestPlayer_CompetitiveWins(t *testing.T) {
 	assert.Equal(t, 190, pl.CompetitiveWins())
 }
 
+func TestPlayer_IsGrabbingHostage(t *testing.T) {
+	pl := playerWithProperty("m_bIsGrabbingHostage", st.PropertyValue{IntVal: 0})
+	pl.demoInfoProvider = s1DemoInfoProvider
+
+	assert.False(t, pl.IsGrabbingHostage())
+
+	pl = playerWithProperty("m_bIsGrabbingHostage", st.PropertyValue{IntVal: 1})
+	pl.demoInfoProvider = s1DemoInfoProvider
+
+	assert.True(t, pl.IsGrabbingHostage())
+}
+
 func newPlayer(tick int) *Player {
 	return NewPlayer(mockDemoInfoProvider(128, tick))
 }
Repository: markus-wa/demoinfocs-golang
Pull request #496 (2024-01-13 11:45:36)

fix: possible invalid weapon in kill events
Following https://github.com/markus-wa/demoinfocs-golang/pull/490.

- It's not always a suffix - it can be a prefix.
- The suffix/prefix is not the killer's name but the words `vip` or `default` (there may be others).
- The team's name may also be part of the suffix/prefix

Noticed with demos coming from https://github.com/akiver/cs-demo-manager/issues/727.  
Example with this one https://mega.nz/file/LZFlhATB#aCO-g1hoGohndAKXJVUHzLCcbyzH-n7cGi9ZWO5UdSM.

Weapon's name from game events:
```
5e_vip_usp_silencer
5e_default_deagle
5e_vip_xm1014
5e_default_mp9
5e_default_galilar
5e_vip_m4a1_silencer
5e_vip_ak47
```


Patch:
diff --git a/pkg/demoinfocs/common/equipment.go b/pkg/demoinfocs/common/equipment.go
index d4f0e3a..7c68ce0 100644
--- a/pkg/demoinfocs/common/equipment.go
+++ b/pkg/demoinfocs/common/equipment.go
@@ -287,7 +287,7 @@ func MapEquipment(eqName string) EquipmentType {
 			wep = EqHelmet
 		} else {
 			for name := range eqNameToWeapon {
-				if strings.HasPrefix(eqName, name) {
+				if strings.HasPrefix(eqName, name) || strings.HasSuffix(eqName, name) {
 					wep = eqNameToWeapon[name]
 					break
 				}


Test patch:
diff --git a/pkg/demoinfocs/common/equipment_test.go b/pkg/demoinfocs/common/equipment_test.go
index 34bb6b6..44d670c 100644
--- a/pkg/demoinfocs/common/equipment_test.go
+++ b/pkg/demoinfocs/common/equipment_test.go
@@ -29,6 +29,14 @@ func TestMapEquipment(t *testing.T) {
 	assert.Equal(t, EqUnknown, MapEquipment("asdf"), "'asdf' should be mapped to EqUnknown")
 }
 
+func TestWeirdCS2Values(t *testing.T) {
+	assert.Equal(t, EqDeagle, MapEquipment("deagle_vip"), "'deagle_vip' should be mapped to EqDeagle")
+	assert.Equal(t, EqUSP, MapEquipment("usp_silencer_vip"), "'usp_silencer_vip' should be mapped to EqUSP")
+	assert.Equal(t, EqUSP, MapEquipment("5e_vip_usp_silencer"), "'5e_vip_usp_silencer' should be mapped to EqUSP")
+	assert.Equal(t, EqAK47, MapEquipment("5e_vip_ak47"), "'5e_vip_ak47' should be mapped to EqAK47")
+	assert.Equal(t, EqDeagle, MapEquipment("5e_default_deagle"), "'5e_default_deagle' should be mapped to EqDeagle")
+}
+
 func TestEquipment_Class(t *testing.T) {
 	assert.Equal(t, EqClassUnknown, NewEquipment(EqUnknown).Class(), "EqUnknown should have the class EqClassUnknown")
 	assert.Equal(t, EqClassPistols, NewEquipment(EqP2000).Class(), "EqP2000 should have the class EqClassPistols")
Repository: Azure/azure-functions-durable-js
Pull request #449 (2023-02-01 19:54:20)

Update OrchestrationHandler type
Second bullet point in #416 . Updates `OrchestrationHandler` type from `(context: OrchestrationContext) => Generator<unknown, unknown, any>` to `OrchestrationHandler<T> = (context: OrchestrationContext) => Generator<Task, T, any>` (`T` being the return type of the generator)

hossam-nasr: For the sake for getting this to move forward before preview with the most benefit possible, I've updated this so that the only change is adding the `Task` type as the only allowed yield type, while leaving `TReturn` as `unknown` and `TNext` as `any`. I've created an issue here though: #488 to track possibly adding the `TReturn` generic for GA

Patch:
diff --git a/types/orchestration.d.ts b/types/orchestration.d.ts
index 62b29ea..07a7e60 100644
--- a/types/orchestration.d.ts
+++ b/types/orchestration.d.ts
@@ -7,7 +7,11 @@ import { EntityId } from "./entity";
  */
 export type OrchestrationHandler = (
     context: OrchestrationContext
-) => Generator<unknown, unknown, any>;
+) => Generator<
+    Task, // orchestrations can only yield Task types
+    unknown, // return type of the orchestration
+    any // what the SDK passes back to the orchestration
+>;
 
 /**
  * Context object passed to orchestration Functions.


Test patch:
diff --git a/test/testobjects/TestOrchestrations.ts b/test/testobjects/TestOrchestrations.ts
index dc778c3..6b5fd03 100644
--- a/test/testobjects/TestOrchestrations.ts
+++ b/test/testobjects/TestOrchestrations.ts
@@ -7,6 +7,7 @@ export class TestOrchestrations {
         return "Hello";
     });
 
+    // @ts-expect-error yielding a non-Task type
     public static YieldInteger: any = createOrchestrator(function* () {
         yield 4;
     });
Repository: styled-components/babel-plugin-styled-components
Pull request #74 (2017-07-11 14:34:07)

Resolves double component name in display name
This PR resolves the [bug](https://github.com/styled-components/babel-plugin-styled-components/issues/73) where the `displayName` and CSS class name include duplicates of the same name when the `componentName` is identical to the `blockName`.

andrewtpoe: I've removed the version bump. If it's all the same, I'll leave the squash to you when merging. 😄 

Patch:
diff --git a/src/visitors/displayNameAndId.js b/src/visitors/displayNameAndId.js
index ebf3838..75c0d2d 100644
--- a/src/visitors/displayNameAndId.js
+++ b/src/visitors/displayNameAndId.js
@@ -6,12 +6,6 @@ import fs from 'fs'
 import hash from '../utils/hash'
 import { isStyled } from '../utils/detectors'
 
-const blockName = (file) => {
-  return file.opts.basename !== 'index' ?
-    file.opts.basename :
-    path.basename(path.dirname(file.opts.filename))
-}
-
 const addConfig = (path, displayName, componentId) => {
   if (!displayName && !componentId) {
     return
@@ -32,11 +26,21 @@ const addConfig = (path, displayName, componentId) => {
   )
 }
 
+const getBlockName = (file) => {
+  return file.opts.basename !== 'index' ?
+    file.opts.basename :
+    path.basename(path.dirname(file.opts.filename))
+}
+
 const getDisplayName = (path, state) => {
   const { file } = state
   const componentName = getName(path)
   if (file) {
-    return componentName ? `${blockName(file)}__${componentName}` : blockName(file)
+    const blockName = getBlockName(file)
+    if (blockName === componentName) {
+      return componentName
+    }
+    return componentName ? `${blockName}__${componentName}` : blockName
   } else {
     return componentName
   }


Test patch:
diff --git a/test/fixtures/05-use-file-name/after.js b/test/fixtures/05-use-file-name/after.js
index 3437baa..3f7ca65 100644
--- a/test/fixtures/05-use-file-name/after.js
+++ b/test/fixtures/05-use-file-name/after.js
@@ -2,13 +2,17 @@ import styled from "styled-components";
 
 const Test = styled.div.withConfig({
   displayName: "before__Test",
-  componentId: "gl3p53-0"
+  componentId: "s1x8c0g0-0"
 })`color:red;`;
+const before = styled.div.withConfig({
+  displayName: "before",
+  componentId: "s1x8c0g0-1"
+})`color:blue;`;
 styled.div.withConfig({
   displayName: "before",
-  componentId: "gl3p53-1"
+  componentId: "s1x8c0g0-2"
 })``;
 export default styled.button.withConfig({
   displayName: "before",
-  componentId: "gl3p53-2"
+  componentId: "s1x8c0g0-3"
 })``;
diff --git a/test/fixtures/05-use-file-name/before.js b/test/fixtures/05-use-file-name/before.js
index 216ba4b..e656c5d 100644
--- a/test/fixtures/05-use-file-name/before.js
+++ b/test/fixtures/05-use-file-name/before.js
@@ -1,5 +1,6 @@
 import styled from "styled-components";
 
 const Test = styled.div`color: red;`;
+const before = styled.div`color: blue;`;
 styled.div``;
 export default styled.button``;
Repository: styled-components/babel-plugin-styled-components
Pull request #227 (2019-06-22 21:41:30)

fix ssr with styled HOC + object styles


Patch:
diff --git a/src/visitors/displayNameAndId.js b/src/visitors/displayNameAndId.js
index f266698..95c1a88 100644
--- a/src/visitors/displayNameAndId.js
+++ b/src/visitors/displayNameAndId.js
@@ -137,9 +137,18 @@ export default t => (path, state) => {
   if (
     path.node.tag
       ? isStyled(t)(path.node.tag, state)
-      : isStyled(t)(path.node.callee, state) &&
-        path.node.callee.property &&
-        path.node.callee.property.name !== 'withConfig'
+      : /* styled()`` */ (isStyled(t)(path.node.callee, state) &&
+          path.node.callee.property &&
+          path.node.callee.property.name !== 'withConfig') ||
+        // styled(x)({})
+        (isStyled(t)(path.node.callee, state) &&
+          !t.isMemberExpression(path.node.callee.callee)) ||
+        // styled(x).attrs()({})
+        (isStyled(t)(path.node.callee, state) &&
+          t.isMemberExpression(path.node.callee.callee) &&
+          path.node.callee.callee.property &&
+          path.node.callee.callee.property.name &&
+          path.node.callee.callee.property.name !== 'withConfig')
   ) {
     const displayName =
       useDisplayName(state) &&


Test patch:
diff --git a/test/fixtures/add-identifier-and-display-name/code.js b/test/fixtures/add-identifier-and-display-name/code.js
index 3f4b612..87814df 100644
--- a/test/fixtures/add-identifier-and-display-name/code.js
+++ b/test/fixtures/add-identifier-and-display-name/code.js
@@ -1,6 +1,11 @@
-const Test = styled.div`width: 100%;`;
-const Test2 = true ? styled.div`` : styled.div``;
+const Test = styled.div`
+  width: 100%;
+`
+const Test2 = true ? styled.div`` : styled.div``
 const styles = { One: styled.div`` }
-let Component;
-Component = styled.div``;
-const WrappedComponent = styled(Inner)``;
+let Component
+Component = styled.div``
+const WrappedComponent = styled(Inner)``
+const WrappedComponent2 = styled.div({})
+const WrappedComponent3 = styled(Inner)({})
+const WrappedComponent4 = styled(Inner).attrs(() => ({ something: 'else' }))({})
diff --git a/test/fixtures/add-identifier-and-display-name/output.js b/test/fixtures/add-identifier-and-display-name/output.js
index c6b4b67..ee53788 100644
--- a/test/fixtures/add-identifier-and-display-name/output.js
+++ b/test/fixtures/add-identifier-and-display-name/output.js
@@ -24,3 +24,17 @@ const WrappedComponent = styled(Inner).withConfig({
   displayName: "WrappedComponent",
   componentId: "sc-1cza72q-5"
 })``;
+const WrappedComponent2 = styled.div.withConfig({
+  displayName: "WrappedComponent2",
+  componentId: "sc-1cza72q-6"
+})({});
+const WrappedComponent3 = styled(Inner).withConfig({
+  displayName: "WrappedComponent3",
+  componentId: "sc-1cza72q-7"
+})({});
+const WrappedComponent4 = styled(Inner).attrs(() => ({
+  something: 'else'
+})).withConfig({
+  displayName: "WrappedComponent4",
+  componentId: "sc-1cza72q-8"
+})({});
Repository: styled-components/babel-plugin-styled-components
Pull request #242 (2019-08-23 21:50:47)

Added detection for withTheme helper so it is given the PURE annotation
Fixes https://github.com/styled-components/babel-plugin-styled-components/issues/241


Patch:
diff --git a/src/utils/detectors.js b/src/utils/detectors.js
index 6cfd038..0909060 100644
--- a/src/utils/detectors.js
+++ b/src/utils/detectors.js
@@ -103,10 +103,14 @@ export const isInjectGlobalHelper = t => (tag, state) =>
 export const isKeyframesHelper = t => (tag, state) =>
   t.isIdentifier(tag) && tag.name === importLocalName('keyframes', state)
 
+export const isWithThemeHelper = t => (tag, state) =>
+  t.isIdentifier(tag) && tag.name === importLocalName('withTheme', state)
+
 export const isHelper = t => (tag, state) =>
-  isCSSHelper(t)(tag, state) || isKeyframesHelper(t)(tag, state)
+  isCSSHelper(t)(tag, state) || isKeyframesHelper(t)(tag, state) || isWithThemeHelper(t)(tag, state)
 
 export const isPureHelper = t => (tag, state) =>
   isCSSHelper(t)(tag, state) ||
   isKeyframesHelper(t)(tag, state) ||
-  isCreateGlobalStyleHelper(t)(tag, state)
+  isCreateGlobalStyleHelper(t)(tag, state) ||
+  isWithThemeHelper(t)(tag, state)


Test patch:
diff --git a/test/fixtures/annotate-withtheme-with-pure-comments/.babelrc b/test/fixtures/annotate-withtheme-with-pure-comments/.babelrc
new file mode 100644
index 0000000..8232aac
--- /dev/null
+++ b/test/fixtures/annotate-withtheme-with-pure-comments/.babelrc
@@ -0,0 +1,10 @@
+{
+  "plugins": [
+    [
+      "../../../src",
+      {
+        "pure": true
+      }
+    ]
+  ]
+}
diff --git a/test/fixtures/annotate-withtheme-with-pure-comments/code.js b/test/fixtures/annotate-withtheme-with-pure-comments/code.js
new file mode 100644
index 0000000..e57fd76
--- /dev/null
+++ b/test/fixtures/annotate-withtheme-with-pure-comments/code.js
@@ -0,0 +1,3 @@
+import { withTheme } from 'styled-components'
+
+const ThemedComponent = withTheme(() => null)
\ No newline at end of file
diff --git a/test/fixtures/annotate-withtheme-with-pure-comments/output.js b/test/fixtures/annotate-withtheme-with-pure-comments/output.js
new file mode 100644
index 0000000..5b4fd54
--- /dev/null
+++ b/test/fixtures/annotate-withtheme-with-pure-comments/output.js
@@ -0,0 +1,4 @@
+import { withTheme } from 'styled-components';
+const ThemedComponent =
+/*#__PURE__*/
+withTheme(() => null);