Skip to content

Commit

Permalink
feat: support git push options (#341)
Browse files Browse the repository at this point in the history
Add support to git push options.

Reference: https://git-scm.com/docs/git-push#Documentation/git-push.txt--oltoptiongt
Fixes: #327
  • Loading branch information
aymanbagabas authored Jul 19, 2023
1 parent 02fd650 commit e4a47c5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion server/git/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
}
Expand Down

0 comments on commit e4a47c5

Please sign in to comment.