Skip to content

Commit

Permalink
refactor(src/hooks.go): Change directory to .polar/hooks before creat…
Browse files Browse the repository at this point in the history
…ing hooks.
  • Loading branch information
plvhx committed Jul 14, 2022
1 parent 3f5457c commit 1b056ff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ func CreateHook(hook, contents string) error {
return hookTypeErr
}

f, err := os.OpenFile(hook, os.O_RDWR | os.O_CREATE, 0755)
err := os.Chdir(".polar/hooks")

if err != nil {
return err
}

finfo, err := f.Stat()
f, err := os.OpenFile(hook, os.O_RDWR | os.O_CREATE, 0755)

if err != nil {
return err
}

if err := f.Truncate(finfo.Size()); err != nil {
if err := f.Truncate(0); err != nil {
return err
}

Expand Down

0 comments on commit 1b056ff

Please sign in to comment.