Skip to content

Commit

Permalink
Add docs about skipping certain git states
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryTsepelev committed Apr 30, 2021
1 parent 547793c commit 99d1c97
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
3 changes: 0 additions & 3 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ func RunCmdExecutor(args []string, fs afero.Fs) error {
if !viper.IsSet(hooksGroup) && hooksGroup == "prepare-commit-msg" {
return nil
}

gitArgs := args[1:]
var wg sync.WaitGroup

Expand Down Expand Up @@ -176,7 +175,6 @@ func RunCmdExecutor(args []string, fs afero.Fs) error {
}

func executeCommand(hooksGroup, commandName string, wg *sync.WaitGroup, gitArgs []string) {
log.Println("executeCommand", hooksGroup)
defer wg.Done()

if getPiped(hooksGroup) && isPipeBroken {
Expand Down Expand Up @@ -235,7 +233,6 @@ func executeCommand(hooksGroup, commandName string, wg *sync.WaitGroup, gitArgs
}

if isSkipCommmand(hooksGroup, commandName) {
log.Println("skipping!!!!")
mutex.Lock()
spinner.RestartWithMsg(sprintSuccess("\n", au.Bold(commandName), au.Brown("(SKIP BY SETTINGS)")))
mutex.Unlock()
Expand Down
22 changes: 21 additions & 1 deletion docs/full_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,26 @@ pre-push:
skip: true
```

## Skipping commands during rebase or merge

You can skip commands during rebase and/or merge by the same `skip` option:

```yml
pre-push:
commands:
packages-audit:
skip: merge
# or
pre-push:
commands:
packages-audit:
skip:
- merge
- rebase
```

## Skipping commands by tags

If we have a lot of commands and scripts we can tag them and run skip commands with a specific tag.
Expand Down Expand Up @@ -281,7 +301,7 @@ If you need to extend config from some another place, just add top level:
```yml
# lefthook.yml
extends:
extends:
- $HOME/work/lefthook-extend.yml
- $HOME/work/lefthook-extend-2.yml
```
Expand Down

0 comments on commit 99d1c97

Please sign in to comment.