@@ -7,39 +7,23 @@ package git
7
7
8
8
import (
9
9
"io/ioutil"
10
+ "path/filepath"
10
11
"testing"
11
12
12
13
"github.com/stretchr/testify/assert"
13
14
"github.com/stretchr/testify/require"
14
15
)
15
16
16
17
func 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
+ }
40
24
defer repo .Close ()
41
25
42
- testBlob , err := repo .GetBlob ("a8d4b49dd073a4a38a7e58385eeff7cc52568697 " )
26
+ testBlob , err := repo .GetBlob ("6c493ff740f9380390d5c9ddef4af18697ac9375 " )
43
27
assert .NoError (t , err )
44
28
45
29
r , err := testBlob .DataAsync ()
@@ -53,13 +37,14 @@ THE SOFTWARE.
53
37
}
54
38
55
39
func Benchmark_Blob_Data (b * testing.B ) {
56
- repo , err := OpenRepository ("../../.git" )
40
+ bareRepo1Path := filepath .Join (testReposDir , "repo1_bare" )
41
+ repo , err := OpenRepository (bareRepo1Path )
57
42
if err != nil {
58
43
b .Fatal (err )
59
44
}
60
45
defer repo .Close ()
61
46
62
- testBlob , err := repo .GetBlob ("a8d4b49dd073a4a38a7e58385eeff7cc52568697 " )
47
+ testBlob , err := repo .GetBlob ("6c493ff740f9380390d5c9ddef4af18697ac9375 " )
63
48
if err != nil {
64
49
b .Fatal (err )
65
50
}
0 commit comments