Skip to content

Commit 98155ea

Browse files
committed
chore: refactor Git hook functions and variables
- Fix typo in `exclude_list` variable name - Rename `git.exclue_list` to `git.exclude_list` - Remove unused code in `hookCmd` function
1 parent 040f7f4 commit 98155ea

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

cmd/commit.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ var commitCmd = &cobra.Command{
5050
}
5151

5252
if len(excludeList) > 0 {
53-
viper.Set("git.exclue_list", excludeList)
53+
viper.Set("git.exclude_list", excludeList)
5454
}
5555

5656
g := git.New(
5757
git.WithDiffUnified(viper.GetInt("git.diff_unified")),
58-
git.WithExcludeList(viper.GetStringSlice("git.exclue_list")),
58+
git.WithExcludeList(viper.GetStringSlice("git.exclude_list")),
5959
)
6060
diff, err := g.DiffFiles()
6161
if err != nil {

cmd/hook.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,12 @@ var hookCmd = &cobra.Command{
2525
if err := g.InstallHook(); err != nil {
2626
return err
2727
}
28-
2928
color.Green("Install git hook: prepare-commit-msg successfully")
3029
color.Green("You can see the hook file: .git/hooks/prepare-commit-msg")
3130
case "uninstall":
3231
if err := g.UninstallHook(); err != nil {
3332
return err
3433
}
35-
3634
color.Green("Remove git hook: prepare-commit-msg successfully")
3735
}
3836

0 commit comments

Comments
 (0)