Skip to content
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

Use hook args in fast path #139

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/builtin/pre_commit_hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub(crate) async fn fix_trailing_whitespace(
_env_vars: Arc<HashMap<&'static str, String>>,
) -> Result<(i32, Vec<u8>)> {
let entry = shlex::split(&hook.entry).ok_or(anyhow::anyhow!("Failed to parse entry"))?;
let args = Args::try_parse_from(entry)?;
let args = Args::try_parse_from(entry.iter().chain(&hook.args))?;

// Validate markdown extensions
if args.markdown_linebreak_ext.contains(&String::new()) {
Expand Down
4 changes: 2 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,9 @@ pub struct ConfigRemoteHook {
pub id: String,
/// Override the name of the hook.
pub name: Option<String>,
/// Not documented in the official docs.
/// Override the entrypoint. Not documented in the official docs but works.
pub entry: Option<String>,
/// Not documented in the official docs.
/// Override the language. Not documented in the official docs but works.
pub language: Option<Language>,
#[serde(flatten)]
pub options: HookOptions,
Expand Down
Loading