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..1f88b33 100644 --- a/tests/cli/new.rs +++ b/tests/cli/new.rs @@ -21,7 +21,13 @@ 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"));