Skip to content

Commit 7b206b5

Browse files
committed
Return ErrNotExist when ref is not valid
1 parent f78bf3b commit 7b206b5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

git.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"time"
1111
)
1212

13-
const _VERSION = "0.3.7"
13+
const _VERSION = "0.3.8"
1414

1515
func Version() string {
1616
return _VERSION

repo_commit.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import (
1818
func (repo *Repository) getRefCommitID(name string) (string, error) {
1919
stdout, err := NewCommand("show-ref", "--verify", name).RunInDir(repo.Path)
2020
if err != nil {
21+
if strings.Contains(err.Error(), "not a valid ref") {
22+
return "", ErrNotExist{name, ""}
23+
}
2124
return "", err
2225
}
2326
return strings.Split(stdout, " ")[0], nil

0 commit comments

Comments
 (0)