0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-12-26 00:54:51 +01:00

Simplify code for wrting SHA to name-rev (#17696)

This commit is contained in:
Gusted 2021-11-18 09:50:22 +00:00 committed by GitHub
parent 878c2ce6e6
commit d1f5584039
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -217,27 +217,18 @@ func FindLFSFile(repo *git.Repository, hash git.SHA1) ([]*LFSResult, error) {
defer wg.Done()
defer shasToNameWriter.Close()
for _, result := range results {
i := 0
if i < len(result.SHA) {
n, err := shasToNameWriter.Write([]byte(result.SHA)[i:])
_, err := shasToNameWriter.Write([]byte(result.SHA))
if err != nil {
errChan <- err
break
}
i += n
}
var err error
n := 0
for n < 1 {
n, err = shasToNameWriter.Write([]byte{'\n'})
_, err = shasToNameWriter.Write([]byte{'\n'})
if err != nil {
errChan <- err
break
}
}
}
}()
wg.Wait()