Skip to content

Commit fdd33f8

Browse files
committed
README touchups
1 parent 77709b0 commit fdd33f8

4 files changed

Lines changed: 95 additions & 131 deletions

File tree

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This file provides guidance to [Claude Code](https://claude.ai/code) when workin
55
Refer to:
66

77
* @docs/development.md
8+
* @docs/schema.md
89
* @docs/style.md
910

1011
Some tips:

README.md

Lines changed: 13 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,6 @@
1515

1616
## Installation
1717

18-
### Prerequisites
19-
20-
- Git (version 2.25+)
21-
- SQLite (version 3.30+)
22-
- Zig (version 0.14.0) - only needed if building from source
23-
24-
### Using Pre-built Binaries (Recommended)
25-
2618
1. Download the latest release for your platform:
2719

2820
```bash
@@ -47,32 +39,23 @@
4739

4840
4. The installation is complete. The binary functions as both a standalone command and as a Git remote helper.
4941

50-
### Building from Source
51-
52-
1. Clone the repository:
53-
54-
```bash
55-
git clone https://github.com/chrislloyd/git-remote-sqlite.git
56-
cd git-remote-sqlite
57-
```
58-
59-
2. Build the binary using Zig:
42+
## Basic Usage
6043

61-
```bash
62-
zig build
63-
```
44+
### 1. Push to/pull from the database
6445

65-
3. Copy the binary to your path:
46+
Push your code to the SQLite database:
6647

67-
```bash
68-
sudo cp zig-out/bin/git-remote-sqlite /usr/local/bin/
69-
```
48+
```bash
49+
git push sqlite://myapp.db main
50+
```
7051

71-
4. The installation is complete. The binary functions as both a standalone command and as a Git remote helper.
52+
Pull it back:
7253

73-
## Basic Usage
54+
```bash
55+
git pull sqlite://myapp.db main
56+
```
7457

75-
### 1. Configure Repository Settings
58+
### 2. Configure Repository Settings
7659

7760
You can configure server-side git settings stored in the SQLite database:
7861

@@ -93,106 +76,11 @@ git-remote-sqlite config myapp.db --unset receive.denyDeletes
9376

9477
These settings are stored in the `git_config` table and affect how git operations are processed when interacting with the SQLite repository.
9578

96-
### 2. Push Code to the Database (Coming Soon)
97-
98-
Push your code to the SQLite database:
99-
100-
```bash
101-
git push sqlite://myapp.db main
102-
```
103-
104-
### 3. Use as a Git Remote (Coming Soon)
105-
106-
Add the database as a git remote:
107-
108-
```bash
109-
# In your existing git repository
110-
git remote add origin sqlite://myapp.db
111-
112-
# Note: 'origin' is just a name for the remote - you can use any name you prefer
113-
```
114-
115-
### 4. Checkout Code from the Database (Coming Soon)
116-
117-
Checkout a specific commit from the database:
118-
119-
```bash
120-
git checkout sqlite://myapp.db main
121-
```
122-
123-
This will extract the specified commit to the current directory.
12479

12580
## Development Status
12681

12782
Currently implemented:
12883
- [x] Configuration management (set, get, list, unset)
129-
- [ ] Git remote helper protocol (push/pull functionality)
130-
- [ ] Git hooks
84+
- [x] Git remote helper protocol (push/pull functionality)
13185
- [ ] Pack file management (tables defined but not yet implemented)
132-
133-
## Database Schema
134-
135-
**git_objects**: Stores git objects (blobs, trees, commits, tags)
136-
137-
| Column | Type | Constraints | Description |
138-
|--|--|--|--|
139-
| `sha` | TEXT | PRIMARY KEY, CHECK(length(sha) = 40 AND sha GLOB '[0-9a-f]*') | Object SHA hash |
140-
| `type` | TEXT | NOT NULL, CHECK(type IN ('blob', 'tree', 'commit', 'tag')) | Object type (blob, tree, commit, tag) |
141-
| `data` | BLOB | NOT NULL | Object content |
142-
143-
*Indexes:*
144-
- `CREATE INDEX idx_git_objects_type ON git_objects(type);` - For efficient queries by object type
145-
146-
**git_refs**: Stores git references
147-
148-
| Column | Type | Constraints | Description |
149-
|--|--|--|--|
150-
| `name` | TEXT | PRIMARY KEY, CHECK(name GLOB 'refs/*') | Reference name (e.g., 'refs/heads/main') |
151-
| `sha` | TEXT | NOT NULL, FOREIGN KEY REFERENCES git_objects(sha) | Commit SHA the ref points to |
152-
| `type` | TEXT | NOT NULL, CHECK(type IN ('branch', 'tag', 'remote')) | Reference type (branch, tag, remote) |
153-
154-
*Indexes:*
155-
- `CREATE INDEX idx_git_refs_sha ON git_refs(sha);` - For finding all refs pointing to a specific commit
156-
157-
**git_symbolic_refs**: Stores symbolic references (like HEAD)
158-
159-
| Column | Type | Constraints | Description |
160-
|--|--|--|--|
161-
| `name` | TEXT | PRIMARY KEY | Symbolic reference name (e.g., 'HEAD') |
162-
| `target` | TEXT | NOT NULL, FOREIGN KEY REFERENCES git_refs(name) | Target reference path |
163-
164-
**git_packs**: Stores git pack files *(pending implementation)*
165-
166-
| Column | Type | Constraints | Description |
167-
|--|--|--|--|
168-
| `id` | INTEGER | PRIMARY KEY | Unique pack identifier |
169-
| `name` | TEXT | NOT NULL, UNIQUE | Pack name/identifier |
170-
| `data` | BLOB | NOT NULL | Pack file binary data |
171-
| `index_data` | BLOB | NOT NULL | Pack index binary data |
172-
173-
*Indexes:*
174-
- `CREATE INDEX idx_git_packs_name ON git_packs(name);` - For efficient lookups by pack name
175-
176-
**git_pack_entries**: Maps objects to packs for faster lookups *(pending implementation)*
177-
178-
| Column | Type | Constraints | Description |
179-
|--|--|--|--|
180-
| `pack_id` | INTEGER | NOT NULL, FOREIGN KEY REFERENCES git_packs(id) | Reference to the pack |
181-
| `sha` | TEXT | NOT NULL, FOREIGN KEY REFERENCES git_objects(sha) | Object SHA contained in the pack |
182-
| `offset` | INTEGER | NOT NULL | Offset position within the pack |
183-
| PRIMARY KEY | | (pack_id, sha) | Composite primary key |
184-
185-
*Indexes:*
186-
- `CREATE INDEX idx_git_pack_entries_sha ON git_pack_entries(sha);` - For finding which pack contains a specific object
187-
188-
189-
**git_config**: Stores git configuration settings
190-
191-
| Column | Type | Constraints | Description |
192-
|--|--|--|--|
193-
| `key` | TEXT | PRIMARY KEY | Configuration key |
194-
| `value` | TEXT | NOT NULL | Configuration value |
195-
196-
## Contributing
197-
198-
Contributions are welcome! Please feel free to submit a Pull Request.
86+
- [ ] Git hooks

docs/development.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
# Development
22

3-
## Stack
3+
### Prerequisites
44

55
* [Zig](https://ziglang.org) 0.14.0
66
* [SQLite](https://www.sqlite.org) >= 3.20.0
77
* [libgit2](https://libgit2.org) >= 1.0.0
88

99
## Building
1010

11-
Build the project using Zig's build system:
11+
1. Clone the repository:
1212

13-
```bash
14-
zig build
15-
```
13+
```bash
14+
git clone https://github.com/chrislloyd/git-remote-sqlite.git
15+
cd git-remote-sqlite
16+
```
17+
18+
2. Build the binary using Zig:
19+
20+
```bash
21+
zig build
22+
```
23+
24+
3. Copy the binary to your path:
25+
26+
```bash
27+
sudo cp zig-out/bin/git-remote-sqlite /usr/local/bin/
28+
```
1629

17-
The binary will be created at `zig-out/bin/git-remote-sqlite`.
30+
4. The installation is complete. The binary functions as both a standalone command and as a Git remote helper.
1831

1932
## Testing
2033

docs/schema.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Database Schema
2+
3+
**git_objects**: Stores git objects (blobs, trees, commits, tags)
4+
5+
| Column | Type | Constraints | Description |
6+
|--|--|--|--|
7+
| `sha` | TEXT | PRIMARY KEY, CHECK(length(sha) = 40 AND sha GLOB '[0-9a-f]*') | Object SHA hash |
8+
| `type` | TEXT | NOT NULL, CHECK(type IN ('blob', 'tree', 'commit', 'tag')) | Object type (blob, tree, commit, tag) |
9+
| `data` | BLOB | NOT NULL | Object content |
10+
11+
*Indexes:*
12+
- `CREATE INDEX idx_git_objects_type ON git_objects(type);` - For efficient queries by object type
13+
14+
**git_refs**: Stores git references
15+
16+
| Column | Type | Constraints | Description |
17+
|--|--|--|--|
18+
| `name` | TEXT | PRIMARY KEY, CHECK(name GLOB 'refs/*') | Reference name (e.g., 'refs/heads/main') |
19+
| `sha` | TEXT | NOT NULL, FOREIGN KEY REFERENCES git_objects(sha) | Commit SHA the ref points to |
20+
| `type` | TEXT | NOT NULL, CHECK(type IN ('branch', 'tag', 'remote')) | Reference type (branch, tag, remote) |
21+
22+
*Indexes:*
23+
- `CREATE INDEX idx_git_refs_sha ON git_refs(sha);` - For finding all refs pointing to a specific commit
24+
25+
**git_symbolic_refs**: Stores symbolic references (like HEAD)
26+
27+
| Column | Type | Constraints | Description |
28+
|--|--|--|--|
29+
| `name` | TEXT | PRIMARY KEY | Symbolic reference name (e.g., 'HEAD') |
30+
| `target` | TEXT | NOT NULL, FOREIGN KEY REFERENCES git_refs(name) | Target reference path |
31+
32+
**git_packs**: Stores git pack files *(pending implementation)*
33+
34+
| Column | Type | Constraints | Description |
35+
|--|--|--|--|
36+
| `id` | INTEGER | PRIMARY KEY | Unique pack identifier |
37+
| `name` | TEXT | NOT NULL, UNIQUE | Pack name/identifier |
38+
| `data` | BLOB | NOT NULL | Pack file binary data |
39+
| `index_data` | BLOB | NOT NULL | Pack index binary data |
40+
41+
*Indexes:*
42+
- `CREATE INDEX idx_git_packs_name ON git_packs(name);` - For efficient lookups by pack name
43+
44+
**git_pack_entries**: Maps objects to packs for faster lookups *(pending implementation)*
45+
46+
| Column | Type | Constraints | Description |
47+
|--|--|--|--|
48+
| `pack_id` | INTEGER | NOT NULL, FOREIGN KEY REFERENCES git_packs(id) | Reference to the pack |
49+
| `sha` | TEXT | NOT NULL, FOREIGN KEY REFERENCES git_objects(sha) | Object SHA contained in the pack |
50+
| `offset` | INTEGER | NOT NULL | Offset position within the pack |
51+
| PRIMARY KEY | | (pack_id, sha) | Composite primary key |
52+
53+
*Indexes:*
54+
- `CREATE INDEX idx_git_pack_entries_sha ON git_pack_entries(sha);` - For finding which pack contains a specific object
55+
56+
57+
**git_config**: Stores git configuration settings
58+
59+
| Column | Type | Constraints | Description |
60+
|--|--|--|--|
61+
| `key` | TEXT | PRIMARY KEY | Configuration key |
62+
| `value` | TEXT | NOT NULL | Configuration value |

0 commit comments

Comments
 (0)