Skip to content

Commit

Permalink
Fix ⚓
Browse files Browse the repository at this point in the history
  • Loading branch information
Nützi, Gabriel committed Dec 27, 2021
1 parent b6a9ffd commit 9febb6d
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions githooks/cmd/installer/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -848,14 +848,20 @@ func setupHookTemplates(
if len(maintainedHooks) == 0 {
maintainedHooks, err = hooks.GetMaintainedHooks(gitx, git.GlobalScope)
log.AssertNoError(err, "Could not get config.")
} else {
// Set maintained hooks in global settings, such that
// local repository Githooks installs are in alignment
// to the setup template directory.
err = hooks.SetMaintainedHooks(gitx, maintainedHooks, git.GlobalScope)
log.AssertNoError(err, "Could not set git config.")

maintainedHooks, err = hooks.UnwrapHookNames(maintainedHooks)
log.AssertNoErrorPanic(err, "Could not build maintained hook list.")
}

allHooks, err := hooks.UnwrapHookNames(maintainedHooks)
log.AssertNoErrorPanic(err, "Could not build maintained hook list.")

nLFSHooks, err := hooks.InstallRunWrappers(
hookTemplateDir,
allHooks,
maintainedHooks,
func(dest string) {
log.InfoF(" %s '%s'", cm.ListItemLiteral, path.Base(dest))
},
Expand All @@ -866,17 +872,12 @@ func setupHookTemplates(

if nLFSHooks != 0 {
log.InfoF("Installed '%v' Githooks run-wrappers and '%v' missing LFS hooks into '%s'.",
len(allHooks), nLFSHooks, hookTemplateDir)
len(maintainedHooks), nLFSHooks, hookTemplateDir)
} else {
log.InfoF("Installed '%v' Githooks run-wrappers into '%s'.",
len(allHooks), hookTemplateDir)
len(maintainedHooks), hookTemplateDir)
}

// Set maintained hooks in global settings, such that
// local repository Githooks installs are in alignment
// to the setup template directory.
err = hooks.SetMaintainedHooks(gitx, maintainedHooks, git.GlobalScope)
log.AssertNoError(err, "Could not set git config.")
}

func installBinaries(
Expand Down

0 comments on commit 9febb6d

Please sign in to comment.