-
-
Notifications
You must be signed in to change notification settings - Fork 162
feat(try-repo): add support for builtin and meta repos #1542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
shaanmajid
wants to merge
3
commits into
j178:master
Choose a base branch
from
shaanmajid:feat/try-repo-builtin-meta
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+729
−181
Conversation
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
f70af0c to
3eb9962
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1542 +/- ##
==========================================
+ Coverage 91.67% 91.75% +0.08%
==========================================
Files 93 93
Lines 18333 18417 +84
==========================================
+ Hits 16807 16899 +92
+ Misses 1526 1518 -8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
📦 Cargo Bloat ComparisonBinary size change: +0.00% (23.7 MiB → 23.7 MiB) Expand for cargo-bloat outputHead Branch ResultsBase Branch Results |
a1bcd98 to
d45ff40
Compare
- Add HookRegistry trait with REPO_NAME constant and all_ids() method - Use EnumIter, EnumString, and IntoStaticStr derives on BuiltinHooks and MetaHooks, replacing manual ALL_IDS constants and FromStr impls - Refactor try_repo to use HookRegistry trait: extract try_special_repo generic over H: HookRegistry, RepoType enum for dispatch, and invoke_run helper to eliminate duplicated run() calls - Make render_repo_config_toml accept Option<&str> for rev to support special repos that don't need a revision Adding a new hook variant now only requires adding an enum variant — the ID string, FromStr, and iteration are all derived via strum.
- Extract TryRepoContext struct to encapsulate store and tmp_dir setup, with run_with_config method handling config writing, printing, and run invocation — replacing the separate invoke_run helper - Add empty-hooks bail to try_git_repo (matching try_special_repo) so selecting a nonexistent hook produces a clear error - Normalize backslashes to forward slashes in rendered TOML repo paths so toml_edit produces consistent double-quoted strings on Windows - Minor cleanups: inline temporary variables, shorten comments
Add comprehensive tests for try-repo with builtin and meta hook repos: - Basic hook execution (trailing-whitespace, identity) - Multiple hooks and all-hooks invocation - Hook filtering with --skip - Invalid hook ID error handling - Case-insensitive repo name matching - Config warning, meta skip, check-hooks-apply, check-useless-excludes Extract test helpers: init_git_repo, setup_basic_context, and filters_with_sha to reduce duplication across test cases.
d45ff40 to
495826a
Compare
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.
Add
try-repo builtinandtry-repo metacommands to test built-in and meta hooks without needing a git repository.Changes:
Add strum crate for enum derives (EnumIter, EnumString, IntoStaticStr)(jk Usestrumderives to reduce handwritten enum parsing and display #1541 added this before me :p)Closes #1521