<commit_before>package main

import (
	"log"
	"os"
	"os/exec"
	"path/filepath"
	"strings"
)

type cloneAction struct {
	Repo string `cli:"arg required"`
	Dst  string `cli:"opt -d --dst default='$HOME/src/github.com'"`
}

func (r *cloneAction) Run() error {
	l := log.New(os.Stderr, "", 0)
	withoutGit := strings.TrimSuffix(r.Repo, ".git")
	withGit := withoutGit + ".git"
	dir := os.ExpandEnv(r.Dst + "/" + withoutGit)
	if stat, err := os.Stat(dir); err == nil {
		if stat.IsDir() {
			l.Printf("repo already cloned to %s", dir)
		} else {
			l.Printf("repo not cloned but a file exists at %s", dir)
		}
		return nil
	}
	err := os.MkdirAll(filepath.Dir(withoutGit), 0755)
	if err != nil {
		return err
	}
	repo := "git@github.com:" + withGit
	l.Printf("cloning %s to %s", repo, dir)
	c := exec.Command("git", "clone", repo, dir)
	c.Stdout = os.Stdout
	c.Stderr = os.Stderr
	err = c.Run()
	if err != nil {
		return err
	}
	l.Printf("cloned into %s", dir)
	return nil
}

func cloneRepo(src, dst string) error {
	return nil
}<commit_msg>clone: do not create empty directories<commit_after>package main

import (
	"log"
	"os"
	"os/exec"
	"path/filepath"
	"strings"
)

type cloneAction struct {
	Repo string `cli:"arg required"`
	Dst  string `cli:"opt -d --dst default='$HOME/src/github.com'"`
}

func (r *cloneAction) Run() error {
	l := log.New(os.Stderr, "", 0)
	withoutGit := strings.TrimSuffix(r.Repo, ".git")
	withGit := withoutGit + ".git"
	dir := os.ExpandEnv(r.Dst + "/" + withoutGit)
	if stat, err := os.Stat(dir); err == nil {
		if stat.IsDir() {
			l.Printf("repo already cloned to %s", dir)
		} else {
			l.Printf("repo not cloned but a file exists at %s", dir)
		}
		return nil
	}
	err := os.MkdirAll(filepath.Dir(dir), 0755)
	if err != nil {
		return err
	}
	repo := "<EMAIL>:" + withGit
	l.Printf("cloning %s to %s", repo, dir)
	c := exec.Command("git", "clone", repo, dir)
	c.Stdout = os.Stdout
	c.Stderr = os.Stderr
	err = c.Run()
	if err != nil {
		return err
	}
	l.Printf("cloned into %s", dir)
	return nil
}

func cloneRepo(src, dst string) error {
	return nil
}
{'fraction_non_alphanumeric': 0.17669715936446798, 'fraction_numerical': 0.004814636494944632, 'mean_word_length': 3.468817204301075, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2531977', 'n_tokens_mistral': 876, 'n_tokens_neox': 840, 'n_words': 227}