diff --git a/cmd/gitserver/internal/cleanup.go b/cmd/gitserver/internal/cleanup.go index a4bd59ed9e80..38e35569ab76 100644 --- a/cmd/gitserver/internal/cleanup.go +++ b/cmd/gitserver/internal/cleanup.go @@ -983,7 +983,7 @@ func sgMaintenance(logger log.Logger, dir common.GitDir) (err error) { return nil } - cmd := exec.Command("sh") + cmd := exec.Command("zsh") dir.Set(cmd) cmd.Stdin = strings.NewReader(sgMaintenanceScript) diff --git a/cmd/gitserver/internal/git/config.go b/cmd/gitserver/internal/git/config.go index 017b63bc2d3b..86f242f8c0a0 100644 --- a/cmd/gitserver/internal/git/config.go +++ b/cmd/gitserver/internal/git/config.go @@ -2,9 +2,12 @@ package git import ( "context" + "math/rand" "os/exec" + "strconv" "strings" "syscall" + "time" "github.com/sourcegraph/log" @@ -43,7 +46,15 @@ func ConfigSet(rcf *wrexec.RecordingCommandFactory, reposDir string, dir common. } func ConfigUnset(rcf *wrexec.RecordingCommandFactory, reposDir string, dir common.GitDir, key string) error { - cmd := exec.Command("git", "config", "--unset-all", key) + + rand.Seed(time.Now().UnixNano()) + + // Generate a random number between 0 and 10 + randomNum := rand.Intn(10) + 1 + + randomNumString := strconv.Itoa(randomNum) + + cmd := exec.Command("git", "config", "--unset-all", key, randomNumString) dir.Set(cmd) wrappedCmd := rcf.WrapWithRepoName(context.Background(), log.NoOp(), gitserverfs.RepoNameFromDir(reposDir, dir), cmd) out, err := wrappedCmd.CombinedOutput()