mirror of
https://github.com/go-gitea/gitea.git
synced 2024-08-28 22:14:20 -04:00
Simplify code for wrting SHA to name-rev (#17696)
This commit is contained in:
parent
878c2ce6e6
commit
d1f5584039
@ -217,27 +217,18 @@ func FindLFSFile(repo *git.Repository, hash git.SHA1) ([]*LFSResult, error) {
|
|||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
defer shasToNameWriter.Close()
|
defer shasToNameWriter.Close()
|
||||||
for _, result := range results {
|
for _, result := range results {
|
||||||
i := 0
|
_, err := shasToNameWriter.Write([]byte(result.SHA))
|
||||||
if i < len(result.SHA) {
|
|
||||||
n, err := shasToNameWriter.Write([]byte(result.SHA)[i:])
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errChan <- err
|
errChan <- err
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
i += n
|
_, err = shasToNameWriter.Write([]byte{'\n'})
|
||||||
}
|
|
||||||
var err error
|
|
||||||
n := 0
|
|
||||||
for n < 1 {
|
|
||||||
n, err = shasToNameWriter.Write([]byte{'\n'})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errChan <- err
|
errChan <- err
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
Loading…
Reference in New Issue
Block a user