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

Option to fully disable LFS hooks #879

Merged
merged 4 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
feat: add option to entirely skip LFS
  • Loading branch information
zachahn-gusto committed Nov 27, 2024
commit 075fa1b9d2cb1b068a798f1fb88164f82ba8a05c
1 change: 1 addition & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type Config struct {
NoTTY bool `mapstructure:"no_tty,omitempty"`
AssertLefthookInstalled bool `mapstructure:"assert_lefthook_installed,omitempty"`
Colors interface{} `mapstructure:"colors,omitempty"`
SkipLFS bool `mapstructure:"skip_lfs,omitempty"`

// Deprecated: use Remotes
Remote *Remote `mapstructure:"remote,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions internal/lefthook/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ func (l *Lefthook) Run(hookName string, args RunArgs, gitArgs []string) error {
GitArgs: gitArgs,
LogSettings: logSettings,
DisableTTY: cfg.NoTTY || args.NoTTY,
SkipLFS: cfg.SkipLFS,
Files: args.Files,
Force: args.Force,
RunOnlyCommands: args.RunOnlyCommands,
Expand Down
5 changes: 5 additions & 0 deletions internal/lefthook/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type Options struct {
GitArgs []string
LogSettings log.Settings
DisableTTY bool
SkipLFS bool
Force bool
Files []string
RunOnlyCommands []string
Expand Down Expand Up @@ -125,6 +126,10 @@ func (r *Runner) RunAll(ctx context.Context, sourceDirs []string) ([]Result, err
}

func (r *Runner) runLFSHook(ctx context.Context) error {
if r.Options.SkipLFS {
return nil
}

if !git.IsLFSHook(r.HookName) {
return nil
}
Expand Down