From 6e86531cd3bef1c9bff90f180dcc286badd54306 Mon Sep 17 00:00:00 2001 From: JSS Date: Wed, 18 Feb 2026 17:54:26 -0500 Subject: [PATCH 1/2] Drop --end-of-options from git reset command The `git reset` command does not universally support the `--end-of-options` flag across all Git versions, causing "fatal: option '--end-of-options' must come before non-option arguments" errors (e.g. on Git 2.39.5). Since the revision argument is programmatically constructed (not arbitrary user input), removing `--end-of-options` is safe and resolves the compatibility issue. Co-Authored-By: Claude Opus 4.6 --- repo.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repo.go b/repo.go index dd327131..be3c7d57 100644 --- a/repo.go +++ b/repo.go @@ -348,7 +348,7 @@ func Reset(repoPath, rev string, opts ...ResetOptions) error { cmd.AddArgs("--hard") } - _, err := cmd.AddOptions(opt.CommandOptions).AddArgs("--end-of-options", rev).RunInDir(repoPath) + _, err := cmd.AddOptions(opt.CommandOptions).AddArgs(rev).RunInDir(repoPath) return err } From 812c966d96b34a80ecf302ab7456c7afb8455dc1 Mon Sep 17 00:00:00 2001 From: JSS Date: Wed, 18 Feb 2026 17:58:07 -0500 Subject: [PATCH 2/2] Add test for package-level Reset function Cover both soft and hard reset modes to verify correct command construction without --end-of-options. Co-Authored-By: Claude Opus 4.6 --- repo_test.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/repo_test.go b/repo_test.go index 7f4ef1c4..812faa27 100644 --- a/repo_test.go +++ b/repo_test.go @@ -11,6 +11,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestRepository(t *testing.T) { @@ -255,6 +256,38 @@ func TestRepository_Checkout(t *testing.T) { } } +func TestReset(t *testing.T) { + tests := []struct { + name string + rev string + opt ResetOptions + }{ + { + name: "soft reset", + rev: "978fb7f6388b49b532fbef8b856681cfa6fcaa0a", + }, + { + name: "hard reset", + rev: "978fb7f6388b49b532fbef8b856681cfa6fcaa0a", + opt: ResetOptions{ + Hard: true, + }, + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + path := tempPath() + defer func() { _ = os.RemoveAll(path) }() + + err := Clone(testrepo.Path(), path) + require.NoError(t, err) + + err = Reset(path, test.rev, test.opt) + assert.NoError(t, err) + }) + } +} + func TestRepository_Reset(t *testing.T) { r, cleanup, err := setupTempRepo() if err != nil {