From e4a47c5f75dd4df97652e7c11429694a9bf62b7b Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Wed, 19 Jul 2023 09:38:51 -0700 Subject: [PATCH] feat: support git push options (#341) Add support to git push options. Reference: https://git-scm.com/docs/git-push#Documentation/git-push.txt--oltoptiongt Fixes: https://github.com/charmbracelet/soft-serve/issues/327 --- server/git/service.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/git/service.go b/server/git/service.go index b5b0f6af4..b2cd6aa26 100644 --- a/server/git/service.go +++ b/server/git/service.go @@ -50,8 +50,15 @@ type ServiceHandler func(ctx context.Context, cmd ServiceCommand) error // gitServiceHandler is the default service handler using the git binary. func gitServiceHandler(ctx context.Context, svc Service, scmd ServiceCommand) error { - cmd := exec.CommandContext(ctx, "git", "-c", "uploadpack.allowFilter=true", svc.Name()) // nolint: gosec + cmd := exec.CommandContext(ctx, "git") cmd.Dir = scmd.Dir + cmd.Args = append(cmd.Args, []string{ + // Enable partial clones + "-c", "uploadpack.allowFilter=true", + // Enable push options + "-c", "receive.advertisePushOptions=true", + svc.Name(), + }...) if len(scmd.Args) > 0 { cmd.Args = append(cmd.Args, scmd.Args...) }