|
|
@ -8,6 +8,7 @@ package git |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"bufio" |
|
|
|
"bufio" |
|
|
|
|
|
|
|
"errors" |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"io" |
|
|
|
"io" |
|
|
|
"io/ioutil" |
|
|
|
"io/ioutil" |
|
|
@ -70,10 +71,15 @@ func (repo *Repository) getCommit(id SHA1) (*Commit, error) { |
|
|
|
bufReader := bufio.NewReader(stdoutReader) |
|
|
|
bufReader := bufio.NewReader(stdoutReader) |
|
|
|
_, typ, size, err := ReadBatchLine(bufReader) |
|
|
|
_, typ, size, err := ReadBatchLine(bufReader) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
|
|
|
|
if errors.Is(err, io.EOF) { |
|
|
|
|
|
|
|
return nil, ErrNotExist{ID: id.String()} |
|
|
|
|
|
|
|
} |
|
|
|
return nil, err |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
switch typ { |
|
|
|
switch typ { |
|
|
|
|
|
|
|
case "missing": |
|
|
|
|
|
|
|
return nil, ErrNotExist{ID: id.String()} |
|
|
|
case "tag": |
|
|
|
case "tag": |
|
|
|
// then we need to parse the tag
|
|
|
|
// then we need to parse the tag
|
|
|
|
// and load the commit
|
|
|
|
// and load the commit
|
|
|
|