<commit_before>import org.eclipse.jgit.api.Git

buildscript {
    repositories { jcenter() }
    dependencies {
        classpath("org.eclipse.jgit:org.eclipse.jgit:4.9.0.201710071750-r")
    }
}

plugins {
    java
}

group = "org.gradle.kotlin.dsl.samples.source-control"
version = "1.0"

tasks {
    "generateGitRepo" {

        inputs.dir("src")
        inputs.files("build.gradle.kts", "settings.gradle.kts")

        val gitRepoDir = file("$buildDir/git-repo")
        outputs.dir(gitRepoDir)

        doLast {
            delete(gitRepoDir)
            delete(temporaryDir)

            val bare = Git.init()
                .setDirectory(gitRepoDir)
                .setBare(true)
                .call()

            val clone = Git.cloneRepository()
                .setURI(bare.repository.directory.toURI().toString())
                .setDirectory(temporaryDir)
                .call()
            copy {
                from(".") {
                    include("src/**")
                    include("*.gradle.kts")
                }
                into(temporaryDir)
            }

            clone.add()
                .addFilepattern("build.gradle.kts")
                .addFilepattern("settings.gradle.kts")
                .addFilepattern("src")
                .call()
            clone.commit()
                .setMessage("Initial import")
                .setAuthor("name", "email")
                .call()

            clone.push().call()
        }
    }
}<commit_msg>Attempt to fix sourceControl sample test flakiness on windows<commit_after>import org.eclipse.jgit.api.Git

buildscript {
    repositories { jcenter() }
    dependencies {
        classpath("org.eclipse.jgit:org.eclipse.jgit:4.9.0.201710071750-r")
    }
}

plugins {
    java
}

group = "org.gradle.kotlin.dsl.samples.source-control"
version = "1.0"

tasks {
    "generateGitRepo" {

        inputs.dir("src")
        inputs.files("build.gradle.kts", "settings.gradle.kts")

        val gitRepoDir = file("$buildDir/git-repo")
        outputs.dir(gitRepoDir)

        doLast {
            delete(gitRepoDir)
            delete(temporaryDir)

            val bareUri = Git.init().setDirectory(gitRepoDir).setBare(true).call().use { bare ->
                bare.repository.directory.toURI().toString()
            }

            Git.cloneRepository().setURI(bareUri).setDirectory(temporaryDir).call().use { clone ->
                copy {
                    from(".") {
                        include("src/**")
                        include("*.gradle.kts")
                    }
                    into(temporaryDir)
                }

                clone.add()
                    .addFilepattern("build.gradle.kts")
                    .addFilepattern("settings.gradle.kts")
                    .addFilepattern("src")
                    .call()
                clone.commit()
                    .setMessage("Initial import")
                    .setAuthor("name", "email")
                    .call()

                clone.push().call()
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.12866449511400652, 'fraction_numerical': 0.011074918566775244, 'mean_word_length': 1.3898832684824902, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '2487727', 'n_tokens_mistral': 924, 'n_tokens_neox': 843, 'n_words': 111}