Skip to content

Conversation

@louisunlimited
Copy link

@louisunlimited louisunlimited commented Oct 28, 2025

Overview

This pr adds the option for commit with no-verify flag on the menu next to green commit button.

Screenshot 2025-10-27 at 20 11 37

Also added an option to show the same no-verify option when dialog popup if hooks failed.

Screenshot 2025-10-27 at 20 13 04

By default, users will get this warning if they want to proceed, and can be toggled on / off in settings.
Screenshot 2025-10-27 at 20 13 19

Question

I did find it difficult to get a general test for git pre-commit hook errors in extensions/git/src/git.ts, as copilot has pointed out, would love to see some better suggestions. If you feel copilot's suggestions are better, feel free to accept that change and run CI.

Testing Instructions

Screen.Recording.2025-10-27.at.20.16.13.mov

Copilot AI review requested due to automatic review settings October 28, 2025 03:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new no-verify option for git commits, allowing users to bypass git hooks when committing changes. This is useful when commit hooks fail and users need to commit anyway.

Key changes:

  • Adds a new git.commitNoVerify command that commits without running git hooks
  • Implements hook failure detection to suggest the no-verify option when commit hooks fail
  • Adds the no-verify command to the commit command options menu

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
extensions/git/src/postCommitCommands.ts Adds "Commit (No Verify)" option to the commit commands menu
extensions/git/src/git.ts Adds detection logic for commit hook failures in git error output
extensions/git/src/commands.ts Adds error handling to suggest no-verify option when commit hooks fail

return GitErrorCodes.WorktreeAlreadyExists;
} else if (/is already used by worktree at/.test(stderr)) {
return GitErrorCodes.WorktreeBranchAlreadyUsed;
} else if (/husky|pre-commit|commit-msg|hook.*failed|\.husky/i.test(stderr)) {
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex pattern includes specific tool names (husky) which makes it brittle and tool-specific. Consider using a more generic pattern that detects git hook failures regardless of the hook manager being used, such as checking for git's standard hook failure messages.

Suggested change
} else if (/husky|pre-commit|commit-msg|hook.*failed|\.husky/i.test(stderr)) {
} else if (/error:.*hook.*failed|fatal:.*hook.*failed|hook declined|hook returned error|hook exited with status/i.test(stderr)) {

Copilot uses AI. Check for mistakes.
@louisunlimited
Copy link
Author

@microsoft-github-policy-service agree

@louisunlimited louisunlimited marked this pull request as ready for review October 28, 2025 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SCM: Add a options to commit without verify when run git's hooks fail

2 participants