Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
radicle/storage/init: Remove placeholder files
✗ CI failure Lorenz Leutgeb committed 2 months ago
commit 5c5bebc1ff6f34ed21b4efe904343277644bbfdd
parent c06b00e330d82c8b8221cc8f8776c883208d159f
1 failed (1 total) View logs
1 file changed +16 -0
modified crates/radicle/src/storage/git.rs
@@ -416,6 +416,22 @@ impl Repository {
                .no_reinit(true)
                .external_template(false),
        )?;
+

+
        {
+
            // Even though `external_template(false)` is called above,
+
            // libgit2 places stub files in the repository:
+
            // https://github.com/libgit2/libgit2/blob/ca225744b992bf2bf24e9a2eb357ddef78179667/src/libgit2/repo_template.h#L52-L54
+
            // This is helpful for a "normal" repository, directly interacted
+
            // with by a human, but not necessary for our use case.
+
            // Attempt to remove these files, but ignore any errors.
+
            // An alternative solution would be to define our own template,
+
            // but distributing that template is way more complex than
+
            // deleting a handful of files.
+
            let _ = fs::remove_dir_all(path.as_ref().join("hooks"));
+
            let _ = fs::remove_file(path.as_ref().join("description"));
+
            let _ = fs::remove_file(path.as_ref().join("info").join("exclude"));
+
        }
+

        let mut config = backend.config()?;

        config.set_str("user.name", &info.name())?;