A file-based task manager
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Drop the title blob from task trees

The `title` blob in each task's tree was a cache of `content`'s first
line — `Task::title()` already computes that for free, so the cache
added nothing while creating drift risk if anything ever wrote one
without the other. patch::write_entry already skipped the blob on
export.

Changes:
- build_tree no longer takes or inserts a `title` entry.
- read still tolerates the field for backward compatibility (it's
matched and discarded).
- Existing trees migrate on next save: `tsk fix-up`'s
`migrate_property_encoding` already re-saves every task, and the
new build_tree drops the title blob in the rewritten tree (smoke-
tested on the live repo: 35 tasks rewritten, ls-tree on the new
tip shows only `content` + property blobs).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

+5 -6
+5 -6
src/object.rs
··· 5 5 //! 6 6 //! Tree layout for a task at any commit: 7 7 //! content → blob: full task body, first line is the title 8 - //! title → blob: cached title (optional; canonical title is content's first line) 9 8 //! <prop-key> → blob: property value (one file per property) 9 + //! 10 + //! Older trees may also contain a `title` blob (a cache of content's first 11 + //! line). It's ignored on read and silently dropped on the next write. 10 12 11 13 use crate::errors::Result; 12 14 use crate::propvalue; ··· 76 78 fn build_tree( 77 79 repo: &Repository, 78 80 content_oid: Oid, 79 - title: &str, 80 81 properties: &BTreeMap<String, Vec<String>>, 81 82 ) -> Result<Oid> { 82 83 let mut tb = repo.treebuilder(None)?; 83 84 tb.insert(CONTENT_FILE, content_oid, 0o100644)?; 84 - let title_oid = repo.blob(title.as_bytes())?; 85 - tb.insert(TITLE_FILE, title_oid, 0o100644)?; 86 85 for (k, values) in properties { 87 86 if k == CONTENT_FILE || k == TITLE_FILE { 88 87 continue; ··· 98 97 pub fn create(repo: &Repository, task: &Task, message: &str) -> Result<StableId> { 99 98 let content_oid = repo.blob(task.content.as_bytes())?; 100 99 let stable = StableId(content_oid.to_string()); 101 - let tree_oid = build_tree(repo, content_oid, task.title(), &task.properties)?; 100 + let tree_oid = build_tree(repo, content_oid, &task.properties)?; 102 101 let sig = signature(repo); 103 102 let commit = repo.commit( 104 103 None, ··· 117 116 /// parent's (idempotent no-op). 118 117 pub fn update(repo: &Repository, id: &StableId, task: &Task, message: &str) -> Result<bool> { 119 118 let content_oid = repo.blob(task.content.as_bytes())?; 120 - let tree_oid = build_tree(repo, content_oid, task.title(), &task.properties)?; 119 + let tree_oid = build_tree(repo, content_oid, &task.properties)?; 121 120 let parent = repo 122 121 .find_reference(&id.refname()) 123 122 .ok()