|
3 | 3 | *Porcelain for adding metadata to any object without rewriting history.* |
4 | 4 |
|
5 | 5 | <!-- rumdl-disable MD013 --> |
6 | | -[](https://github.com/git-ents/git-metadata/actions/workflows/CI.yml) |
7 | | -[](https://github.com/git-ents/git-metadata/actions/workflows/CD.yml) |
| 6 | +[](https://github.com/git-ents/git-metadata/actions/workflows/CI.yml) [](https://github.com/git-ents/git-metadata/actions/workflows/CD.yml) |
8 | 7 | <!-- rumdl-enable MD013 --> |
9 | 8 |
|
10 | 9 | > [!CAUTION] |
11 | | -> This project is being actively developed! |
12 | | -> Despite this, semantic versioning rules will be respected. |
13 | | -> Expect frequent updates. |
| 10 | +> This project is in active development. |
| 11 | +> There are surely bugs and misbehaviors that have not yet been discovered. |
| 12 | +> Please file a [new issue] for any misbehaviors you find! |
14 | 13 |
|
15 | | -## About |
| 14 | +[new issue]: https://github.com/git-ents/git-metadata/issues/new |
| 15 | + |
| 16 | +## Overview |
16 | 17 |
|
17 | 18 | To support a more expansive usage of the Git object database — as is the goal for other projects within the [`git-ents`](https://github.com/git-ents) organization — new tooling is needed. |
18 | 19 | This project provides a command that allows users to associate arbitrary data to any object in Git's store. |
| 20 | +The `metadata` command follows `notes` semantics. |
| 21 | + |
| 22 | +[Notes] are a tragically underutilized feature of Git. |
| 23 | +For more information about `git notes` entries, Tyler Cipriani's [blog post] is an excellent introduction, and some highly-motivating examples. |
| 24 | +One such example is Google's open-source [`git-appraise`] project, which stores code review metadata as structured entries in a note blob. |
| 25 | +While impressive, that design highlights a limitation of notes: structured data, or data that does not map cleanly onto UTF-8 text, is difficult to represent in a blob format. |
| 26 | +The `git-metadata` project provides a structured alternative to the notes-blob design using Git trees objects. |
| 27 | +Just like notes, metadata added to an object does not alter the object's history. |
| 28 | + |
| 29 | +> [!TIP] |
| 30 | +> Unlike notes, `metadata` is not added to `git log`. |
| 31 | +
|
| 32 | +[Notes]: https://git-scm.com/docs/git-notes |
| 33 | +[blog post]: https://tylercipriani.com/blog/2022/11/19/git-notes-gits-coolest-most-unloved-feature/ |
| 34 | +[`git-appraise`]: https://github.com/google/git-appraise |
| 35 | + |
| 36 | +## Usage |
| 37 | + |
| 38 | +Given any blob (file), tree (folder), or commit, add metadata using `metadata add`. |
| 39 | +By default, `add` assumes you're adding metadata to `HEAD`. |
| 40 | +Alternatively, use the `--oid` option to specify a Git object identifier. |
| 41 | +To remove metadata for a particular object, use `metadata remove` and provide glob patterns which represent entries in the metadata tree to be deleted. |
| 42 | +Use the `--keep` option to instead specify patterns to keep. |
| 43 | +For more information, see `git metadata --help`. |
| 44 | + |
| 45 | +## Installation |
| 46 | + |
| 47 | +### CLI |
| 48 | + |
| 49 | +The `git-metadata` plumbing command can be installed with `cargo install`. |
| 50 | + |
| 51 | +```shell |
| 52 | +cargo install --locked git-metadata |
| 53 | +``` |
| 54 | + |
| 55 | +If `~/.cargo/bin` is on your `PATH`, you can invoke the command with `git`. |
| 56 | + |
| 57 | +```shell |
| 58 | +git metadata -h |
| 59 | +``` |
| 60 | + |
| 61 | +### Library |
| 62 | + |
| 63 | +The `git-metadata` library can be added to your Rust project via `cargo add`. |
| 64 | + |
| 65 | +```shell |
| 66 | +cargo add git-metadata |
| 67 | +``` |
0 commit comments