From 40465503210576862c297e8879847f2226d2575c Mon Sep 17 00:00:00 2001 From: Kinflou Date: Sun, 1 Nov 2026 01:24:33 +0800 Subject: [PATCH 1/2] new: commit the version history; ignore only fetched dependencies --- docs/cli.md | 7 ++++--- src/commands/new.rs | 5 +++-- tests/cli/new.rs | 5 ++++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/cli.md b/docs/cli.md index bc708fe..c196936 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -65,7 +65,7 @@ my-api/ ├── comline.toml # where `generate` writes code and how (all-commented by default) ├── src/ │ └── main.ids # a sample enum + struct to build on -└── .gitignore # ignores .comline/ +└── .gitignore # ignores .comline/deps-cache/ ``` `config.idp` starts as: @@ -91,8 +91,9 @@ reduced to a valid Comline identifier (letters, digits and `_`), so After the first `comline build`, a `.comline/` directory appears next to `config.idp`. It holds the content-addressable store (`objects/`) and the version -ref (`refs/heads/main`). It is build output — keep it out of version control (the -scaffold's `.gitignore` already does). +ref (`refs/heads/main`). It is the package's version history, so commit it. +Only `.comline/deps-cache/`, where git dependencies are fetched, is a local cache; +the scaffold's `.gitignore` ignores that and nothing else. ## Versioning model diff --git a/src/commands/new.rs b/src/commands/new.rs index e45b9f2..d318eec 100644 --- a/src/commands/new.rs +++ b/src/commands/new.rs @@ -23,8 +23,9 @@ struct Greeting { "; const GITIGNORE: &str = "\ -# Comline build artifacts -.comline/ +# `.comline/` holds the package's version history: commit it. +# Fetched git dependencies are a local cache. +.comline/deps-cache/ "; /// Consumer-owned code-generation config. Committed. All-commented by default — diff --git a/tests/cli/new.rs b/tests/cli/new.rs index 6a46f46..a6e729e 100644 --- a/tests/cli/new.rs +++ b/tests/cli/new.rs @@ -21,7 +21,10 @@ fn scaffolds_a_buildable_project() { assert!(root.join("config.idp").exists()); assert!(root.join("comline.toml").exists()); assert!(root.join("src/greeting.ids").exists()); - assert!(root.join(".gitignore").exists()); + // The version history is committed; only fetched dependencies are ignored. + let gitignore = fs::read_to_string(root.join(".gitignore")).unwrap(); + assert!(gitignore.lines().any(|l| l == ".comline/deps-cache/"), "{gitignore}"); + assert!(!gitignore.lines().any(|l| l == ".comline/"), "{gitignore}"); let config = fs::read_to_string(root.join("config.idp")).unwrap(); assert!(config.contains("congregation my_api")); From 98ec23c3867d1d154f042630d00e5a52654f085d Mon Sep 17 00:00:00 2001 From: Kinflou Date: Sun, 1 Nov 2026 01:24:45 +0800 Subject: [PATCH 2/2] tests: rustfmt --- tests/cli/new.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/cli/new.rs b/tests/cli/new.rs index a6e729e..1f88b33 100644 --- a/tests/cli/new.rs +++ b/tests/cli/new.rs @@ -23,7 +23,10 @@ fn scaffolds_a_buildable_project() { assert!(root.join("src/greeting.ids").exists()); // The version history is committed; only fetched dependencies are ignored. let gitignore = fs::read_to_string(root.join(".gitignore")).unwrap(); - assert!(gitignore.lines().any(|l| l == ".comline/deps-cache/"), "{gitignore}"); + assert!( + gitignore.lines().any(|l| l == ".comline/deps-cache/"), + "{gitignore}" + ); assert!(!gitignore.lines().any(|l| l == ".comline/"), "{gitignore}"); let config = fs::read_to_string(root.join("config.idp")).unwrap();