Conversation
🦋 Changeset detectedLatest commit: ba8591b The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Note
This report is out of date. Scroll down for Devin Review's latest report on this PR.
Devin Review found 2 potential issues.
2 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
| const COMMAND_USAGE: Record<string, string> = { | ||
| add: "git add [-A] <path>...", | ||
| branch: "git branch [-d|-D <name>] [--show-current] [<name>]", | ||
| "cat-file": "git cat-file (-p|-t|-s) <oid>[:<path>]", | ||
| checkout: "git checkout [-b <name>] [-f] <ref> [--] [<path>...]", | ||
| clean: "git clean [-f] [-d] [-n] [<path>...]", | ||
| clone: | ||
| "git clone [--depth <n>] [--branch <ref>] [--single-branch|--no-single-branch] <url> [<dir>]", | ||
| commit: "git commit -m <message> [-a]", | ||
| config: "git config [--get] <key> [<value>]", | ||
| diff: "git diff [--stat] [--name-only] [<ref>] [--] [<path>...]", | ||
| fetch: "git fetch [<remote>] [<ref>]", | ||
| "hash-object": "git hash-object [-w] [-t <type>] <path>", | ||
| init: "git init [<dir>]", | ||
| log: "git log [-n <count>] [-<count>] [--oneline] [<ref>]", | ||
| "ls-files": "git ls-files [<ref>]", | ||
| "ls-tree": "git ls-tree <ref> [<path>]", | ||
| merge: "git merge [--ff-only] [--no-ff] <ref>", | ||
| pull: "git pull [<remote>] [<ref>]", | ||
| push: "git push [-f|--force] [--delete] [<remote>] [<refspec>]", | ||
| remote: "git remote [-v] [add <name> <url>] [remove <name>]", | ||
| reset: "git reset [--hard|--soft|--mixed] [<ref>] [--] [<path>...]", | ||
| "rev-parse": "git rev-parse <rev>", | ||
| rm: "git rm [--cached] [-r] <path>...", | ||
| show: "git show [<ref>]", | ||
| stash: "git stash [push|pop|apply|list|drop]", | ||
| status: "git status [-s|--short|--porcelain]", | ||
| switch: "git switch [-c <name>] <ref>", | ||
| "symbolic-ref": "git symbolic-ref <name> [<ref>]", | ||
| tag: "git tag [-d <name>] [<name> [<ref>]]", | ||
| "update-ref": "git update-ref <ref> <oid>", | ||
| help: "git help [<command>]", | ||
| version: "git version", |
There was a problem hiding this comment.
clone defaulted to depth 1. That made it fast, but it quietly cost the caller their history: pushing such a clone somewhere else sent only the single commit it had fetched, reported success, and left a remote whose tip hash matched while every earlier commit was missing. A content diff against that remote passes, so nothing surfaces the loss until someone looks for a parent that is not there. Default to full history and leave the shallow case to an explicit --depth, where the caller is choosing speed knowingly. Three smaller gaps go with it. cat-file grew -t and -s, which readObject already had the type and size for. log grew --format and its --pretty alias over the commonly scripted placeholders, leaving an unrecognized one as written so it shows up in the output rather than vanishing. help grew a per-command form; it previously ignored its argument and reprinted the list, which left no way to discover a command's flags except guessing and reading the exit code.
The usage lines went in by hand and several described a command that does not exist. hash-object advertised a positional path when it only reads --stdin, reset offered --soft and --mixed when both are explicitly refused, and log omitted the --format it had just gained. A caller following that help got exit 129 for doing what it said. Correct every line against the flags its parser actually declares, including the short spellings that were missing, and add a test that walks each advertised long flag back through the command it belongs to. Drift now fails a test rather than reaching a caller. Normalize --pretty to --format while parsing, rather than reading whichever key happened to be set. They are one option in real git, so the last one written should win; before this, --format always did regardless of order.
There was a problem hiding this comment.
Devin Review found 2 new potential issues.
4 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
| if (mode === "t") { | ||
| return { stdout: `${result.type ?? "blob"}\n`, stderr: "", exitCode: 0 }; | ||
| } | ||
| if (mode === "s") { | ||
| return { stdout: `${result.bytes.byteLength}\n`, stderr: "", exitCode: 0 }; |
There was a problem hiding this comment.
🟡 Tree subpath metadata always fails
When <oid>:<path> names a directory, -t and -s use the blob-only filepath path. The command fails instead of returning the tree type or size.
Learn more
The CLI accepts <oid>:<path> for every new mode, but GitClient.catFile receives no mode. With filepath set, catFileWith always calls readBlob, which only resolves blob targets. A directory target therefore fails before the CLI can inspect result.type or result.bytes.
Example: git cat-file -t HEAD:src must print tree. The current call asks readBlob for src, which rejects the tree and makes the command exit with an error.
Recommended fix: Pass the requested mode through the cat-file API, or add a generic object-resolution path for filepath. Resolve the target object first, then use readObject({ format: "content" }) so tree subpaths expose both their type and raw byte size. Preserve the existing blob fast path for -p where applicable.
Was this helpful? React with 👍 or 👎 to provide feedback.
| // full list, which left no way to discover a command's flags short of | ||
| // guessing and reading the exit code. | ||
| if (topic !== undefined) { | ||
| const usage = COMMAND_USAGE[topic]; |
There was a problem hiding this comment.
🟡 Prototype names receive false help
When topic is constructor or another inherited name, COMMAND_USAGE[topic] returns an Object prototype member. git help exits zero and prints function source for an unsupported command.
| const usage = COMMAND_USAGE[topic]; | |
| const usage = Object.hasOwn(COMMAND_USAGE, topic) ? COMMAND_USAGE[topic] : undefined; |
Was this helpful? React with 👍 or 👎 to provide feedback.
commit: |
The
git clonecommand defaulted to a depth of1, so a clone then push ended up wiping the remote history.Clone now fetches full history, and a shallow clone is something the caller asks for:
Speed was the reason for the old default and it is still available. It is just no longer the silent choice, because the caller who wanted speed and the caller who wanted their history had no way to tell them apart.
Three smaller gaps in the same command set go with it.
cat-fileread an object's bytes but could not report its type or size, whichreadObjectalready returned:Exactly one of the three is required, matching real git. The typed surface carries the type alongside the bytes:
loghad--onelineand nothing else, so any other shape meant post-processing the default output. It now takes--formatand its alias--pretty:The placeholders are
%H,%h,%s,%b,%an,%ae,%ad,%cn,%ce,%cd, and%%, plus the named formatoneline. Anything outside that set is left as written, so an unsupported placeholder appears in the output rather than disappearing from it.git help <command>ignored its argument and reprinted the full command list, leaving no way to find a command's flags except guessing and reading the exit code. It now answers the question asked, listing only the flags this wrapper accepts:To check the clone change, clone any repository with history and count the commits: the number should match the source rather than be
1. The other three are visible directly from the examples above.Tests cover each one: that clone requests full history by default and still honors an explicit depth, that
cat-filereports type and size and rejects combining the modes, that the log placeholders expand and an unknown one survives untouched, and thathelpanswers for one command, still lists everything when asked for nothing, and reports a command it does not have.The git interface documentation covers the new clone default, the
cat-filemodes, the log placeholders, and the per-command help.