From 8dd6a5524cdae8ebea77162279fb5027bca7ee39 Mon Sep 17 00:00:00 2001 From: zerone0x Date: Fri, 27 Mar 2026 00:07:33 +0800 Subject: [PATCH] fix: enable push options on local bare repo to support newer git versions When users have push.pushOption configured in their git config or use git versions that send push options by default, pushing to the local bare repository fails with "the receiving end does not support push options". Fix by setting receive.advertisePushOptions=true on the bare repo during initialization. Fixes #323 --- repository/repository.go | 8 ++++++++ repository/repository_test.go | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/repository/repository.go b/repository/repository.go index dac0cfa2..dc55949e 100644 --- a/repository/repository.go +++ b/repository/repository.go @@ -143,6 +143,14 @@ func (r *Repository) ensureFork(ctx context.Context) error { os.RemoveAll(r.forkRepoPath) return err } + // Enable push options support so that pushes from user repos with + // push.pushOption configured (or git versions that send push options + // by default) don't fail with "the receiving end does not support + // push options". See https://github.com/dagger/container-use/issues/323 + if _, err := RunGitCommand(ctx, r.forkRepoPath, "config", "receive.advertisePushOptions", "true"); err != nil { + os.RemoveAll(r.forkRepoPath) + return err + } return nil }) } diff --git a/repository/repository_test.go b/repository/repository_test.go index 2d2924b4..5f30ebef 100644 --- a/repository/repository_test.go +++ b/repository/repository_test.go @@ -64,5 +64,10 @@ func TestRepositoryOpen(t *testing.T) { remote, err := RunGitCommand(ctx, tempDir, "remote", "get-url", "container-use") require.NoError(t, err) assert.Equal(t, repo.forkRepoPath, strings.TrimSpace(remote)) + + // Verify push options are enabled on the fork repo (issue #323) + pushOpts, err := RunGitCommand(ctx, repo.forkRepoPath, "config", "receive.advertisePushOptions") + require.NoError(t, err) + assert.Equal(t, "true", strings.TrimSpace(pushOpts)) }) }