Skip to content

Commit bb4157e

Browse files
jss-spectorclaude
andauthored
Drop --end-of-options from git reset command (#134)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0300f96 commit bb4157e

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ func Reset(repoPath, rev string, opts ...ResetOptions) error {
348348
cmd.AddArgs("--hard")
349349
}
350350

351-
_, err := cmd.AddOptions(opt.CommandOptions).AddArgs("--end-of-options", rev).RunInDir(repoPath)
351+
_, err := cmd.AddOptions(opt.CommandOptions).AddArgs(rev).RunInDir(repoPath)
352352
return err
353353
}
354354

repo_test.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"testing"
1212

1313
"github.com/stretchr/testify/assert"
14+
"github.com/stretchr/testify/require"
1415
)
1516

1617
func TestRepository(t *testing.T) {
@@ -255,6 +256,38 @@ func TestRepository_Checkout(t *testing.T) {
255256
}
256257
}
257258

259+
func TestReset(t *testing.T) {
260+
tests := []struct {
261+
name string
262+
rev string
263+
opt ResetOptions
264+
}{
265+
{
266+
name: "soft reset",
267+
rev: "978fb7f6388b49b532fbef8b856681cfa6fcaa0a",
268+
},
269+
{
270+
name: "hard reset",
271+
rev: "978fb7f6388b49b532fbef8b856681cfa6fcaa0a",
272+
opt: ResetOptions{
273+
Hard: true,
274+
},
275+
},
276+
}
277+
for _, test := range tests {
278+
t.Run(test.name, func(t *testing.T) {
279+
path := tempPath()
280+
defer func() { _ = os.RemoveAll(path) }()
281+
282+
err := Clone(testrepo.Path(), path)
283+
require.NoError(t, err)
284+
285+
err = Reset(path, test.rev, test.opt)
286+
assert.NoError(t, err)
287+
})
288+
}
289+
}
290+
258291
func TestRepository_Reset(t *testing.T) {
259292
r, cleanup, err := setupTempRepo()
260293
if err != nil {

0 commit comments

Comments
 (0)