@@ -7,39 +7,23 @@ package git
77
88import (
99 "io/ioutil"
10+ "path/filepath"
1011 "testing"
1112
1213 "github.com/stretchr/testify/assert"
1314 "github.com/stretchr/testify/require"
1415)
1516
1617func TestBlob_Data (t * testing.T ) {
17- output := `Copyright (c) 2016 The Gitea Authors
18- Copyright (c) 2015 The Gogs Authors
19-
20- Permission is hereby granted, free of charge, to any person obtaining a copy
21- of this software and associated documentation files (the "Software"), to deal
22- in the Software without restriction, including without limitation the rights
23- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24- copies of the Software, and to permit persons to whom the Software is
25- furnished to do so, subject to the following conditions:
26-
27- The above copyright notice and this permission notice shall be included in
28- all copies or substantial portions of the Software.
29-
30- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
36- THE SOFTWARE.
37- `
38- repo , err := OpenRepository ("../../.git" )
39- assert .NoError (t , err )
18+ output := "file2\n "
19+ bareRepo1Path := filepath .Join (testReposDir , "repo1_bare" )
20+ repo , err := OpenRepository (bareRepo1Path )
21+ if ! assert .NoError (t , err ) {
22+ t .Fatal ()
23+ }
4024 defer repo .Close ()
4125
42- testBlob , err := repo .GetBlob ("a8d4b49dd073a4a38a7e58385eeff7cc52568697 " )
26+ testBlob , err := repo .GetBlob ("6c493ff740f9380390d5c9ddef4af18697ac9375 " )
4327 assert .NoError (t , err )
4428
4529 r , err := testBlob .DataAsync ()
@@ -53,13 +37,14 @@ THE SOFTWARE.
5337}
5438
5539func Benchmark_Blob_Data (b * testing.B ) {
56- repo , err := OpenRepository ("../../.git" )
40+ bareRepo1Path := filepath .Join (testReposDir , "repo1_bare" )
41+ repo , err := OpenRepository (bareRepo1Path )
5742 if err != nil {
5843 b .Fatal (err )
5944 }
6045 defer repo .Close ()
6146
62- testBlob , err := repo .GetBlob ("a8d4b49dd073a4a38a7e58385eeff7cc52568697 " )
47+ testBlob , err := repo .GetBlob ("6c493ff740f9380390d5c9ddef4af18697ac9375 " )
6348 if err != nil {
6449 b .Fatal (err )
6550 }
0 commit comments