feat: inspect commit history with git tree <commit> [<commit>]#18
Open
wteuber wants to merge 1 commit into
Open
feat: inspect commit history with git tree <commit> [<commit>]#18wteuber wants to merge 1 commit into
git tree <commit> [<commit>]#18wteuber wants to merge 1 commit into
Conversation
Add two history-inspection modes that reuse the existing tree renderer: git tree <commit> files changed in <commit> (vs. its first parent) git tree <c1> <c2> files that differ between two commits git tree <c1>..<c2> same, as a single range token diff-tree -z output is translated into the porcelain entry strings the Node pipeline already understands. Commit-mode entries render in a distinct cyan color (separate from the green=staged / red=dirty working-tree palette) with the git status letter; -M rename detection shows `old -> new (R)`. Root commits list every file as added; an empty diff prints `(no changes)`. Invalid revisions and the unsupported `A...B` range fail with a clear error. The -i/--indent and -c/--collapse options apply in all modes; -u is ignored for commit views. No version bump yet (changelog entry under [Unreleased]). Also bumps json/prism/unicode-emoji in Gemfile.lock to versions whose required_ruby_version allows Ruby 4.0 (the pinned .ruby-version), keeping RuboCop at 1.77.0 to match CI. Spec: docs/specs/git-tree-commit-args.md (tracking issue #6)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two history-inspection modes that reuse the existing
Node/NodesCollectiontree renderer verbatim.git treewith no args is unchanged.git treegit tree <commit><commit>(vs. its first parent)git tree <c1> <c2>git tree <c1>..<c2><commit>is any revision git accepts (SHA,HEAD,HEAD~3, branch, tag).How it works
git diff-tree --name-status -zoutput is translated into the porcelain entry strings the node pipeline already understands, so everything downstream is reused. Commit-mode entries render in a distinct cyan color (separate from the green=staged / red=dirty working-tree palette) with the git status letter (A/M/D/R/T);-Mrename detection showsold -> new (R).--root).(no changes).A...Brange fail with a clear error and non-zero exit; 3+ positional args are rejected with usage.-i/--indentand-c/--collapseapply in all modes;-u/--untracked-filesis ignored for commit views.Tests
test_command_line_commit.rb,test_command_line_commit_range.rb(A/M/D, renames across dirs, root commit, no-changes, invalid rev, range token, reversed order, options in range mode).test/git_status_tree/test_parse_diff_tree.rb(the-ztoken walk: regular entries, rename/copy triplets, similarity-score stripping, empty stream, multibyte paths).test_git_status_tree_class.rb, plus a teardown that resetsNode's class-level state (indent/collapse_dirs/mode) so the suite is order-independent.ruby test/coverage.rb(the CI path): 199 runs, 0 failures, 100.00% library coverage. Verified on Ruby 2.6 (support floor) and 4.0.4.Notes
[Unreleased];VERSIONstays3.6.0.Gemfile.lockbump (json/prism/unicode-emoji) to versions whoserequired_ruby_versionallows Ruby 4.0 — the previously lockedunicode-emoji 4.0.4forbids Ruby 4.0 (the pinned.ruby-version), breakingbundleon 4.0.x. RuboCop stays pinned at 1.77.0 to match CI. Happy to split this out if you'd prefer the PR to be feature-only.docs/specs/git-tree-commit-args.md(tracking issue git tree [<commit>] [<commit>] #6).