Skip to content

Commit 10ff092

Browse files
committed
refactor
1 parent 4a46ab9 commit 10ff092

File tree

1 file changed

+6
-24
lines changed

1 file changed

+6
-24
lines changed

.github/copilot-instructions.md

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ This repository contains `gitoxide` - a pure Rust implementation of Git. This do
1313

1414
### Test-First Development
1515
- Protect against regression and make implementing features easy
16-
- Use containers to test elaborate user interactions
1716
- Keep it practical - the Rust compiler handles mundane things
1817
- Use git itself as reference implementation; run same tests against git where feasible
19-
- Never use `.unwrap()`, not even in tests. Use `quick_error!()` or `Box<dyn std::error::Error>` instead
20-
- Use `.expect("why")` with context explaining why expectations should hold
18+
- Never use `.unwrap()` in production code, avoid it in tests in favor of `.expect()` or `?`. Use `gix_testtools::Result` most of the time.
19+
- Use `.expect("why")` with context explaining why expectations should hold, but only if it's relevant to the test.
2120

2221
### Error Handling
2322
- Handle all errors, never `unwrap()`
@@ -38,20 +37,13 @@ Follow "purposeful conventional commits" style:
3837

3938
### Code Style
4039
- Follow existing patterns in the codebase
41-
- Use `gix_hash::ObjectId` and `gix_hash::oid` to prepare for SHA256 support
42-
- No `.unwrap()` - use `.expect("context")` with clear reasoning
40+
- No `.unwrap()` - use `.expect("context")` if you are sure this can't fail.
4341
- Prefer references in plumbing crates to avoid expensive clones
4442
- Use `gix_features::threading::*` for interior mutability primitives
4543

46-
### Async Usage
47-
- Provide async clients as opt-in using feature toggles
48-
- Server-side: support async out of the box with conditional compilation
49-
- Use `blocking` to make `Read` and `Iterator` async when needed
50-
- Long-running operations support interruption via `gix_features::interrupt`
51-
5244
### Path Handling
5345
- Paths are byte-oriented in git (even on Windows via MSYS2 abstraction)
54-
- Use `os_str_bytes` to convert git paths to `OsStr`/`Path` or use custom types
46+
- Use `gix::path::*` utilities to convert git paths (`BString`) to `OsStr`/`Path` or use custom types
5547

5648
## Building and Testing
5749

@@ -77,24 +69,14 @@ Follow "purposeful conventional commits" style:
7769
- **Plumbing crates**: Low-level, take references, expose mutable parts as arguments
7870
- **Porcelain (gix)**: High-level, convenient, may clone Repository for user convenience
7971
- Platforms: cheap to create, keep reference to Repository
80-
- Caches: more expensive, clone Repository or free of lifetimes
72+
- Caches: more expensive, clone `Repository` or free of lifetimes
8173

8274
### Options vs Context
8375
- Use `Options` for branching behavior configuration (can be defaulted)
8476
- Use `Context` for data required for operation (cannot be defaulted)
8577

86-
### Default Trait Implementations
87-
- Can change only if effect is contained within caller's process
88-
- Changing default file version is a breaking change
89-
9078
## Crate Organization
9179

92-
### Stability Tiers
93-
1. **Production Grade** (Tier 1-2): `gix-lock`, `gix-tempfile`
94-
2. **Stabilization Candidates**: Feature-complete, need more use before 1.0
95-
3. **Initial Development**: Usable but possibly incomplete
96-
4. **Very Early/Idea**: Minimal implementation or placeholders
97-
9880
### Common Crates
9981
- `gix`: Main library entrypoint (porcelain)
10082
- `gix-object`, `gix-ref`, `gix-config`: Core git data structures
@@ -111,7 +93,7 @@ Follow "purposeful conventional commits" style:
11193
## CI and Releases
11294
- Ubuntu-latest git version is the compatibility target
11395
- `cargo smart-release` for releases (driven by commit messages)
114-
- Split breaking changes into separate commits per affected crate
96+
- Split breaking changes into separate commits per affected crate if one commit-message wouldn't be suitable for all changed crates.
11597
- First commit: breaking change only; second commit: adaptations
11698

11799
## When Suggesting Changes

0 commit comments

Comments
 (0)