File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,9 @@ func (i *Installer) EnableBackup(backup bool) {
5151}
5252
5353func (i * Installer ) Run () error {
54+ if i .skipInstall () {
55+ return nil
56+ }
5457 hooks := i .getHooksToInstall ()
5558
5659 // do some sort magic because go range random is weird
@@ -273,6 +276,20 @@ func (i *Installer) checkForBrokenSymlink(hook string) error {
273276 return nil
274277}
275278
279+ func (i * Installer ) skipInstall () bool {
280+ hooksPath := i .repo .HooksDir ()
281+ if (hooksPath == "/dev/null" ) || (hooksPath == "NUL" ) {
282+ i .appIO .Write (
283+ fmt .Sprintf (
284+ "<warning>can't install hooks to %s please check your 'core.hooksPath' config</warning>" , hooksPath ),
285+ true ,
286+ io .NORMAL ,
287+ )
288+ return true
289+ }
290+ return false
291+ }
292+
276293func NewInstaller (appIO io.IO , config * configuration.Configuration , repo git.Repo ) * Installer {
277294 return & Installer {
278295 appIO : appIO ,
You can’t perform that action at this time.
0 commit comments