about summary refs log tree commit diff
path: root/users/Profpatsch/git-db
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2024-09-13T11·23+0200
committerProfpatsch <mail@profpatsch.de>2024-09-13T12·06+0000
commitaf5ce5489f309097a395b82e4d7b689dfaff6ec4 (patch)
treeb82f473bffac61fee4b849629a42991ac6ff3d51 /users/Profpatsch/git-db
parentfcd4bfccdf1e529e2e9c1bbb09b305248534418c (diff)
chore(users/Profpatsch): remove git-db & rust deps r/8685
This never went anywhere.

We had problems with `git2` breaking, so let’s remove everything that
this pulled in.

Change-Id: Ia29d827cd6fc7b97aedca36a37f8418384579c38
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12474
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
Diffstat (limited to 'users/Profpatsch/git-db')
-rw-r--r--users/Profpatsch/git-db/default.nix12
-rw-r--r--users/Profpatsch/git-db/git-db.rs90
2 files changed, 0 insertions, 102 deletions
diff --git a/users/Profpatsch/git-db/default.nix b/users/Profpatsch/git-db/default.nix
deleted file mode 100644
index 340fc3430882..000000000000
--- a/users/Profpatsch/git-db/default.nix
+++ /dev/null
@@ -1,12 +0,0 @@
-{ depot, pkgs, lib, ... }:
-
-(depot.nix.writers.rustSimple
-  {
-    name = "git-db";
-    dependencies = [
-      depot.third_party.rust-crates.git2
-    ];
-  }
-  (builtins.readFile ./git-db.rs)) // {
-  meta.broken = true;
-}
diff --git a/users/Profpatsch/git-db/git-db.rs b/users/Profpatsch/git-db/git-db.rs
deleted file mode 100644
index c8019bf03661..000000000000
--- a/users/Profpatsch/git-db/git-db.rs
+++ /dev/null
@@ -1,90 +0,0 @@
-extern crate git2;
-use std::os::unix::ffi::OsStrExt;
-use std::path::PathBuf;
-
-const DEFAULT_BRANCH: &str = "refs/heads/main";
-
-fn main() {
-    let git_db_dir = std::env::var_os("GIT_DB_DIR").expect("set GIT_DB_DIR");
-    let git_db = PathBuf::from(git_db_dir).join("git");
-
-    std::fs::create_dir_all(&git_db).unwrap();
-
-    let repo = git2::Repository::init_opts(
-        &git_db,
-        git2::RepositoryInitOptions::new()
-            .bare(true)
-            .mkpath(true)
-            .description("git-db database")
-            .initial_head(DEFAULT_BRANCH),
-    )
-    .expect(&format!(
-        "unable to create or open bare git repo at {}",
-        &git_db.display()
-    ));
-
-    let mut index = repo.index().expect("cannot get the git index file");
-    eprintln!("{:#?}", index.version());
-    index.clear().expect("could not clean the index");
-
-    let now = std::time::SystemTime::now()
-        .duration_since(std::time::SystemTime::UNIX_EPOCH)
-        .expect("unable to get system time");
-
-    let now_git_time = git2::IndexTime::new(
-        now.as_secs() as i32, // lol
-        u32::from(now.subsec_nanos()),
-    );
-
-    let data = "hi, it’s me".as_bytes();
-
-    index
-        .add_frombuffer(
-            &git2::IndexEntry {
-            mtime: now_git_time,
-            ctime: now_git_time,
-            // don’t make sense
-            dev: 0,
-            ino: 0,
-            mode: /*libc::S_ISREG*/ 0b1000 << (3+9) | /* read write for owner */ 0o644,
-            uid: 0,
-            gid: 0,
-            file_size: data.len() as u32, // lol again
-            id: git2::Oid::zero(),
-            flags: 0,
-            flags_extended: 0,
-            path: "hi.txt".as_bytes().to_owned(),
-        },
-            data,
-        )
-        .expect("could not add data to index");
-
-    let oid = index.write_tree().expect("could not write index tree");
-
-    let to_add_tree = repo
-        .find_tree(oid)
-        .expect("we just created this tree, where did it go?");
-
-    let parent_commits = match repo.find_reference(DEFAULT_BRANCH) {
-        Ok(ref_) => vec![ref_.peel_to_commit().expect(&format!(
-            "reference {} does not point to a commit",
-            DEFAULT_BRANCH
-        ))],
-        Err(err) => match err.code() {
-            // no commit exists yet
-            git2::ErrorCode::NotFound => vec![],
-            _ => panic!("could not read latest commit from {}", DEFAULT_BRANCH),
-        },
-    };
-    repo.commit(
-        Some(DEFAULT_BRANCH),
-        &git2::Signature::now("Mr. Authorboy", "author@example.com").unwrap(),
-        &git2::Signature::now("Mr. Commiterboy", "committer@example.com").unwrap(),
-        "This is my first commit!\n\
-         \n\
-         I wonder if it supports extended commit descriptions?\n",
-        &to_add_tree,
-        &parent_commits.iter().collect::<Vec<_>>()[..],
-    )
-    .expect("could not commit the index we just wrote");
-}