mirror of
https://github.com/Dasemu/Grove.git
synced 2026-11-26 23:36:11 +00:00
chore: rename project to grove and add MIT license
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
126acb4b57
commit
c935d779e1
29 files changed
+99
-76
No files matched your search
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "gitsync-core"
|
||||
description = "Sync engine for gitsync: snapshots, state classification"
|
||||
name = "grove-core"
|
||||
description = "Sync engine for grove: snapshots, state classification"
|
||||
edition.workspace = true
|
||||
version.workspace = true
|
||||
|
||||
@@ -130,20 +130,20 @@ impl Config {
|
||||
Config::parse(&text)
|
||||
}
|
||||
|
||||
/// Default location: `$XDG_CONFIG_HOME/gitsync/config.toml` or `~/.config/...`.
|
||||
/// Default location: `$XDG_CONFIG_HOME/grove/config.toml` or `~/.config/...`.
|
||||
pub fn default_path() -> Option<PathBuf> {
|
||||
let base = std::env::var_os("XDG_CONFIG_HOME")
|
||||
.map(PathBuf::from)
|
||||
.or_else(|| std::env::var_os("HOME").map(|h| PathBuf::from(h).join(".config")))?;
|
||||
Some(base.join("gitsync/config.toml"))
|
||||
Some(base.join("grove/config.toml"))
|
||||
}
|
||||
|
||||
/// Local state directory: `$XDG_STATE_HOME/gitsync` or `~/.local/state/gitsync`.
|
||||
/// Local state directory: `$XDG_STATE_HOME/grove` or `~/.local/state/grove`.
|
||||
pub fn state_dir() -> Option<PathBuf> {
|
||||
let base = std::env::var_os("XDG_STATE_HOME")
|
||||
.map(PathBuf::from)
|
||||
.or_else(|| std::env::var_os("HOME").map(|h| PathBuf::from(h).join(".local/state")))?;
|
||||
Some(base.join("gitsync"))
|
||||
Some(base.join("grove"))
|
||||
}
|
||||
|
||||
/// `root.path` with a leading `~` expanded.
|
||||
@@ -224,7 +224,7 @@ mirror_to = ["github"]
|
||||
fetch_interval_s = 30
|
||||
[config_repo]
|
||||
provider = "gitea-main"
|
||||
name = "gitsync-config"
|
||||
name = "grove-config"
|
||||
"#;
|
||||
|
||||
#[test]
|
||||
File renamed without changes.
File renamed without changes.
@@ -70,7 +70,7 @@ mod tests {
|
||||
fn invariants_hold_for_random_names() {
|
||||
let alphabet: Vec<char> = "ab/._- é\\:*?\"<>|0Z".chars().collect();
|
||||
let mut seed = 0x1234_5678_u64;
|
||||
let mut taken: Vec<String> = vec![".bare".into(), ".gitsync-stage".into()];
|
||||
let mut taken: Vec<String> = vec![".bare".into(), ".grove-stage".into()];
|
||||
for _ in 0..2000 {
|
||||
let len = {
|
||||
seed = seed
|
||||
File renamed without changes.
@@ -13,7 +13,7 @@ use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
|
||||
const BARE: &str = ".bare";
|
||||
const STAGE: &str = ".gitsync-stage";
|
||||
const STAGE: &str = ".grove-stage";
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum MigrateError {
|
||||
File renamed without changes.
@@ -36,7 +36,7 @@ fn temp_index_path() -> PathBuf {
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.map(|d| d.as_nanos())
|
||||
.unwrap_or(0);
|
||||
std::env::temp_dir().join(format!("gitsync-index-{}-{nanos}", std::process::id()))
|
||||
std::env::temp_dir().join(format!("grove-index-{}-{nanos}", std::process::id()))
|
||||
}
|
||||
|
||||
/// Take a snapshot of `worktree` for `machine`. `message_stamp` is embedded in the
|
||||
@@ -58,10 +58,10 @@ pub fn take(worktree: &Path, machine: &str, message_stamp: &str) -> Result<Outco
|
||||
let snap = git
|
||||
.clone()
|
||||
.with_env("GIT_INDEX_FILE", tmp.0.to_string_lossy())
|
||||
.with_env("GIT_AUTHOR_NAME", "gitsync")
|
||||
.with_env("GIT_AUTHOR_EMAIL", "gitsync@localhost")
|
||||
.with_env("GIT_COMMITTER_NAME", "gitsync")
|
||||
.with_env("GIT_COMMITTER_EMAIL", "gitsync@localhost");
|
||||
.with_env("GIT_AUTHOR_NAME", "grove")
|
||||
.with_env("GIT_AUTHOR_EMAIL", "grove@localhost")
|
||||
.with_env("GIT_COMMITTER_NAME", "grove")
|
||||
.with_env("GIT_COMMITTER_EMAIL", "grove@localhost");
|
||||
|
||||
snap.run(&["add", "-A"])?;
|
||||
let tree = snap.run(&["write-tree"])?;
|
||||
@@ -75,7 +75,7 @@ pub fn take(worktree: &Path, machine: &str, message_stamp: &str) -> Result<Outco
|
||||
}
|
||||
|
||||
let head = snap.probe(&["rev-parse", "-q", "--verify", "HEAD"])?;
|
||||
let message = format!("gitsync snapshot {machine} {message_stamp}");
|
||||
let message = format!("grove snapshot {machine} {message_stamp}");
|
||||
let mut args: Vec<&str> = vec!["commit-tree", &tree];
|
||||
if let Some(h) = &head {
|
||||
args.extend(["-p", h]);
|
||||
File renamed without changes.
File renamed without changes.
@@ -1,11 +1,11 @@
|
||||
#![allow(dead_code)]
|
||||
use gitsync_core::git::Git;
|
||||
use grove_core::git::Git;
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
pub fn tmpdir(tag: &str) -> PathBuf {
|
||||
let p = std::env::temp_dir().join(format!(
|
||||
"gitsync-test-{tag}-{}-{}",
|
||||
"grove-test-{tag}-{}-{}",
|
||||
std::process::id(),
|
||||
std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
@@ -1,12 +1,12 @@
|
||||
use gitsync_core::git::Git;
|
||||
use gitsync_core::inspect::{state, worktrees};
|
||||
use gitsync_core::state::State;
|
||||
use grove_core::git::Git;
|
||||
use grove_core::inspect::{state, worktrees};
|
||||
use grove_core::state::State;
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
fn tmpdir(tag: &str) -> PathBuf {
|
||||
let p = std::env::temp_dir().join(format!(
|
||||
"gitsync-test-{tag}-{}-{}",
|
||||
"grove-test-{tag}-{}-{}",
|
||||
std::process::id(),
|
||||
std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
@@ -1,7 +1,7 @@
|
||||
mod common;
|
||||
use common::*;
|
||||
use gitsync_core::git::Git;
|
||||
use gitsync_core::migrate::{MigrateError, Step, migrate, migrate_failing_after};
|
||||
use grove_core::git::Git;
|
||||
use grove_core::migrate::{MigrateError, Step, migrate, migrate_failing_after};
|
||||
use std::fs;
|
||||
|
||||
fn names(dir: &std::path::Path) -> Vec<String> {
|
||||
@@ -136,7 +136,7 @@ fn every_failure_point_rolls_back_to_the_original_layout() {
|
||||
}
|
||||
}
|
||||
|
||||
fn refused(r: Result<gitsync_core::migrate::Report, MigrateError>) -> String {
|
||||
fn refused(r: Result<grove_core::migrate::Report, MigrateError>) -> String {
|
||||
match r {
|
||||
Err(MigrateError::Refused(m)) => m,
|
||||
other => panic!("expected Refused, got {other:?}"),
|
||||
@@ -1,10 +1,10 @@
|
||||
mod common;
|
||||
use common::*;
|
||||
use gitsync_core::git::Git;
|
||||
use gitsync_core::migrate::migrate;
|
||||
use gitsync_core::receive::*;
|
||||
use gitsync_core::snapshot::take;
|
||||
use gitsync_core::state::State;
|
||||
use grove_core::git::Git;
|
||||
use grove_core::migrate::migrate;
|
||||
use grove_core::receive::*;
|
||||
use grove_core::snapshot::take;
|
||||
use grove_core::state::State;
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
|
||||
@@ -277,7 +277,7 @@ fn gone_branch_with_local_changes_is_kept_and_flagged() {
|
||||
}
|
||||
|
||||
fn state_of(p: &std::path::Path) -> State {
|
||||
gitsync_core::inspect::state(p)
|
||||
grove_core::inspect::state(p)
|
||||
}
|
||||
|
||||
// ---- regression tests for the review findings ----
|
||||
@@ -372,7 +372,7 @@ fn snapshot_apply_declines_instead_of_overwriting_local_ignored_file() {
|
||||
|
||||
#[test]
|
||||
fn archive_and_receive_in_one_pass_do_not_collide_on_backup_refs() {
|
||||
use gitsync_core::sync::{Options, sync_repo};
|
||||
use grove_core::sync::{Options, sync_repo};
|
||||
let w = world();
|
||||
migrate(&w.d2, "m2", &w.base.join("bk"), "1").unwrap();
|
||||
let root = w.d2.canonicalize().unwrap();
|
||||
@@ -1,11 +1,11 @@
|
||||
use gitsync_core::git::Git;
|
||||
use gitsync_core::snapshot::{Outcome, take};
|
||||
use grove_core::git::Git;
|
||||
use grove_core::snapshot::{Outcome, take};
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
fn tmpdir(tag: &str) -> PathBuf {
|
||||
let p = std::env::temp_dir().join(format!(
|
||||
"gitsync-test-{tag}-{}-{}",
|
||||
"grove-test-{tag}-{}-{}",
|
||||
std::process::id(),
|
||||
std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
@@ -1,9 +1,9 @@
|
||||
mod common;
|
||||
use common::*;
|
||||
use gitsync_core::git::Git;
|
||||
use gitsync_core::receive::Applied;
|
||||
use gitsync_core::state::State;
|
||||
use gitsync_core::sync::{Options, sync_repo};
|
||||
use grove_core::git::Git;
|
||||
use grove_core::receive::Applied;
|
||||
use grove_core::state::State;
|
||||
use grove_core::sync::{Options, sync_repo};
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
[package]
|
||||
name = "gitsync"
|
||||
description = "gitsync command line client"
|
||||
name = "grove"
|
||||
description = "grove command line client"
|
||||
edition.workspace = true
|
||||
version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.104"
|
||||
clap = { version = "4.6.7", features = ["derive"] }
|
||||
gitsync-core = { version = "0.1.0", path = "../gitsync-core" }
|
||||
grove-core = { version = "0.1.0", path = "../grove-core" }
|
||||
@@ -1,22 +1,19 @@
|
||||
use anyhow::{Context, Result, bail};
|
||||
use clap::{Parser, Subcommand};
|
||||
use gitsync_core::config::Config;
|
||||
use gitsync_core::git::Git;
|
||||
use gitsync_core::inspect::{state, worktrees};
|
||||
use gitsync_core::migrate::migrate;
|
||||
use gitsync_core::receive::{Applied, Archived, Received};
|
||||
use gitsync_core::snapshot::{Outcome, take};
|
||||
use gitsync_core::sync::{Options, SyncReport, git_dir_for, sync_repo};
|
||||
use grove_core::config::Config;
|
||||
use grove_core::git::Git;
|
||||
use grove_core::inspect::{state, worktrees};
|
||||
use grove_core::migrate::migrate;
|
||||
use grove_core::receive::{Applied, Archived, Received};
|
||||
use grove_core::snapshot::{Outcome, take};
|
||||
use grove_core::sync::{Options, SyncReport, git_dir_for, sync_repo};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(
|
||||
name = "gitsync",
|
||||
about = "Keep git workspaces in sync across machines"
|
||||
)]
|
||||
#[command(name = "grove", about = "Keep git workspaces in sync across machines")]
|
||||
struct Cli {
|
||||
/// Path to config.toml (default: $XDG_CONFIG_HOME/gitsync/config.toml)
|
||||
/// Path to config.toml (default: $XDG_CONFIG_HOME/grove/config.toml)
|
||||
#[arg(long, global = true)]
|
||||
config: Option<PathBuf>,
|
||||
#[command(subcommand)]
|
||||
@@ -3,7 +3,7 @@ use std::path::{Path, PathBuf};
|
||||
use std::process::{Command, Output};
|
||||
|
||||
fn tmp(tag: &str) -> PathBuf {
|
||||
let p = std::env::temp_dir().join(format!("gitsync-cli-{tag}-{}", std::process::id()));
|
||||
let p = std::env::temp_dir().join(format!("grove-cli-{tag}-{}", std::process::id()));
|
||||
let _ = fs::remove_dir_all(&p);
|
||||
fs::create_dir_all(&p).unwrap();
|
||||
p
|
||||
@@ -24,7 +24,7 @@ fn git(dir: &Path, args: &[&str]) -> String {
|
||||
}
|
||||
|
||||
fn gs(cfg: &Path, dir: &Path, args: &[&str]) -> Output {
|
||||
Command::new(env!("CARGO_BIN_EXE_gitsync"))
|
||||
Command::new(env!("CARGO_BIN_EXE_grove"))
|
||||
.current_dir(dir)
|
||||
.arg("--config")
|
||||
.arg(cfg)
|
||||
Reference in new issue
Block a user