diff options
author | Gusted <williamzijl7@hotmail.com> | 2021-11-18 09:50:22 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-18 04:50:22 -0500 |
commit | d1f5584039b46c70e4abfb933a928a28e6065965 (patch) | |
tree | 65de91dc8d79977c1916bf1b3f78b83be2ada3f9 /modules | |
parent | 878c2ce6e63e20e147c1e306a834bde15b06cb88 (diff) | |
download | gitea-d1f5584039b46c70e4abfb933a928a28e6065965.tar.gz gitea-d1f5584039b46c70e4abfb933a928a28e6065965.zip |
Simplify code for wrting SHA to name-rev (#17696)
Diffstat (limited to 'modules')
-rw-r--r-- | modules/git/pipeline/lfs_nogogit.go | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/modules/git/pipeline/lfs_nogogit.go b/modules/git/pipeline/lfs_nogogit.go index a441e37b60..4aa21dd05f 100644 --- a/modules/git/pipeline/lfs_nogogit.go +++ b/modules/git/pipeline/lfs_nogogit.go @@ -217,24 +217,15 @@ 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:]) - if err != nil { - errChan <- err - break - } - i += n + _, err := shasToNameWriter.Write([]byte(result.SHA)) + if err != nil { + errChan <- err + break } - var err error - n := 0 - for n < 1 { - n, err = shasToNameWriter.Write([]byte{'\n'}) - if err != nil { - errChan <- err - break - } - + _, err = shasToNameWriter.Write([]byte{'\n'}) + if err != nil { + errChan <- err + break } } |