Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

Commit ec8256d

Browse files
authored
Otherwise git hook fails if only untracked (#76)
* Otherwise git hook fails if only untracked * Simplify git hook * Simplify git hook * Replace deprecated ioutils
1 parent 7c4f8e8 commit ec8256d

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

.husky/hooks/pre-push

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
if [[ -n "$(git status --short)" ]]; then
3+
if git status --short | grep -qv "??"; then
44
git stash
55
function unstash() {
66
git reset --hard

pkg/utils/file.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ package utils
1717

1818
import (
1919
"fmt"
20-
"io/ioutil"
20+
"os"
2121
"strings"
2222
)
2323

2424
// ReadFile reads a file from the given path.
2525
func ReadFile(path string) (string, error) {
26-
content, err := ioutil.ReadFile(path)
26+
content, err := os.ReadFile(path)
2727
if err != nil {
2828
return "", fmt.Errorf("unable to read secret: %s, error: %s", path, err)
2929
}

pkg/utils/http.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"encoding/json"
2121
"fmt"
2222
"io"
23-
"io/ioutil"
2423
"net/http"
2524
"strings"
2625
"time"
@@ -77,7 +76,7 @@ func doHttpRequest(method, url string, body io.Reader, headers map[string]string
7776
}
7877

7978
defer resp.Body.Close()
80-
content, err := ioutil.ReadAll(resp.Body)
79+
content, err := io.ReadAll(resp.Body)
8180
if err != nil {
8281
logger.Error(err, "Unable to read content")
8382
return nil, resp.StatusCode, errors.Wrap(err, "unable to read HTTP response")

0 commit comments

Comments
 (0)