|
|
|
@ -43,8 +43,6 @@ func FindLFSFile(repo *git.Repository, hash git.SHA1) ([]*LFSResult, error) {
|
|
|
|
|
|
|
|
|
|
basePath := repo.Path
|
|
|
|
|
|
|
|
|
|
hashStr := hash.String()
|
|
|
|
|
|
|
|
|
|
// Use rev-list to provide us with all commits in order
|
|
|
|
|
revListReader, revListWriter := io.Pipe()
|
|
|
|
|
defer func() {
|
|
|
|
@ -74,7 +72,7 @@ func FindLFSFile(repo *git.Repository, hash git.SHA1) ([]*LFSResult, error) {
|
|
|
|
|
|
|
|
|
|
fnameBuf := make([]byte, 4096)
|
|
|
|
|
modeBuf := make([]byte, 40)
|
|
|
|
|
workingShaBuf := make([]byte, 40)
|
|
|
|
|
workingShaBuf := make([]byte, 20)
|
|
|
|
|
|
|
|
|
|
for scan.Scan() {
|
|
|
|
|
// Get the next commit ID
|
|
|
|
@ -132,8 +130,7 @@ func FindLFSFile(repo *git.Repository, hash git.SHA1) ([]*LFSResult, error) {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
n += int64(count)
|
|
|
|
|
sha := git.To40ByteSHA(sha20byte)
|
|
|
|
|
if bytes.Equal(sha, []byte(hashStr)) {
|
|
|
|
|
if bytes.Equal(sha20byte, hash[:]) {
|
|
|
|
|
result := LFSResult{
|
|
|
|
|
Name: curPath + string(fname),
|
|
|
|
|
SHA: curCommit.ID.String(),
|
|
|
|
@ -143,7 +140,9 @@ func FindLFSFile(repo *git.Repository, hash git.SHA1) ([]*LFSResult, error) {
|
|
|
|
|
}
|
|
|
|
|
resultsMap[curCommit.ID.String()+":"+curPath+string(fname)] = &result
|
|
|
|
|
} else if string(mode) == git.EntryModeTree.String() {
|
|
|
|
|
trees = append(trees, sha)
|
|
|
|
|
sha40Byte := make([]byte, 40)
|
|
|
|
|
git.To40ByteSHA(sha20byte, sha40Byte)
|
|
|
|
|
trees = append(trees, sha40Byte)
|
|
|
|
|
paths = append(paths, curPath+string(fname)+"/")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|