update some tests and docs - #57
Conversation
Signed-off-by: jackieismpc <jackieismpc@gmail.com>
Signed-off-by: jackieismpc <jackieismpc@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Quanyi Ma <eli@patch.sh>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Quanyi Ma <eli@patch.sh>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Quanyi Ma <eli@patch.sh>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Quanyi Ma <eli@patch.sh>
Signed-off-by: jackieismpc <jackieismpc@gmail.com>
Signed-off-by: jackieismpc <jackieismpc@gmail.com>
Signed-off-by: jackieismpc <jackieismpc@gmail.com>
Signed-off-by: jackieismpc <jackieismpc@gmail.com>
Signed-off-by: jackieismpc <jackieismpc@gmail.com>
Signed-off-by: jackieismpc <jackieismpc@gmail.com>
Signed-off-by: jackieismpc <jackieismpc@gmail.com>
|
@codex review |
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive test coverage across the codebase and improves documentation, with a focus on ensuring both SHA-1 and SHA-256 hash algorithms are properly tested. The changes refactor duplicated test code into helper functions that test both hash kinds, add new tests for protocol layers, and introduce example programs demonstrating library usage.
Key changes:
- Test refactoring: Consolidated duplicate SHA-1/SHA-256 tests into parameterized helper functions
- New test coverage: Added tests for protocol layers (smart, SSH, HTTP, core), pack operations, and internal object handling
- Documentation additions: New example programs demonstrating hashing, pack encoding/decoding, and tree creation
- Documentation improvements: Added doc comments to previously undocumented public functions and structs
Reviewed changes
Copilot reviewed 35 out of 36 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/GIT_OBJECTS.md | CRITICAL: Contains unresolved merge conflict markers |
| docs/ARCHITECTURE.md | CRITICAL: Contains massive duplication (3-4 copies) and merge conflicts |
| src/protocol/* | Added comprehensive test coverage for smart protocol, types, SSH, HTTP, and core modules |
| src/internal/pack/* | Refactored tests to eliminate duplication; consolidated SHA-1/SHA-256 test variants |
| src/internal/object/* | Refactored tests using helper functions; improved test organization |
| src/internal/zlib/stream/inflate.rs | Added tests for inflate operations; minor typo in comments |
| src/internal/index.rs | Added new unit tests for Index operations |
| src/internal/metadata/* | Added doc comments to public APIs |
| Examples/*.rs | Added four new example programs (minor Chinese comment in one file) |
| .gitignore | Added examples/output_packs to ignore list |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Jackie <jackieismpc@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Jackie <jackieismpc@gmail.com> Signed-off-by: jackieismpc <jackieismpc@gmail.com>
bb06123 to
ddb6f89
Compare
There was a problem hiding this comment.
💡 Codex Review
https://github.com/web3infra-foundation/git-internal/blob/ddb6f8904e9ff09d25a91f706c2b939ebf43ba24/src/protocol/core.rs#L250-L257
upload-pack response drops required pkt-line header
In GitProtocol::upload_pack the wrapper discards the BytesMut header returned by SmartProtocol::git_upload_pack (line 256 returns only the pack stream). The upload-pack response in protocol v0/v1 must begin with pkt-line status such as NAK/ACK before the packfile bytes; HTTP handler handle_upload_pack uses this wrapper, so clients will receive a stream containing only raw pack data with no initial pkt-line and will reject the response or hang waiting for the status line.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
* add 2 docs Signed-off-by: jackieismpc <jackieismpc@gmail.com> * update readme Signed-off-by: jackieismpc <jackieismpc@gmail.com> * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Quanyi Ma <eli@patch.sh> * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Quanyi Ma <eli@patch.sh> * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Quanyi Ma <eli@patch.sh> * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Quanyi Ma <eli@patch.sh> * update src/delta Signed-off-by: jackieismpc <jackieismpc@gmail.com> * modify some docs Signed-off-by: jackieismpc <jackieismpc@gmail.com> * update protocol doc and tests Signed-off-by: jackieismpc <jackieismpc@gmail.com> * update docs and tests Signed-off-by: jackieismpc <jackieismpc@gmail.com> * fix a bug Signed-off-by: jackieismpc <jackieismpc@gmail.com> * update object Signed-off-by: jackieismpc <jackieismpc@gmail.com> * update pack Signed-off-by: jackieismpc <jackieismpc@gmail.com> * add examples and Analyze the coverage of test cases. Signed-off-by: jackieismpc <jackieismpc@gmail.com> * Update Examples/create_tree.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Jackie <jackieismpc@gmail.com> * Update docs/GIT_OBJECTS.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Jackie <jackieismpc@gmail.com> Signed-off-by: jackieismpc <jackieismpc@gmail.com> --------- Signed-off-by: jackieismpc <jackieismpc@gmail.com> Signed-off-by: Quanyi Ma <eli@patch.sh> Signed-off-by: Jackie <jackieismpc@gmail.com> Co-authored-by: Quanyi Ma <eli@patch.sh> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
#52
update some tests and docs