@@ -7,23 +7,18 @@ package git
7
import (
7
import (
8
"path/filepath"
8
"path/filepath"
9
"testing"
9
"testing"
10
- "time"
11
10
12
"github.com/stretchr/testify/assert"
11
"github.com/stretchr/testify/assert"
13
)
12
)
14
13
15
func TestGetLatestCommitTime (t * testing.T ) {
14
func TestGetLatestCommitTime (t * testing.T ) {
16
- lct , err := GetLatestCommitTime ("." )
15
+ bareRepo1Path := filepath .Join (testReposDir , "repo1_bare" )
16
+ lct , err := GetLatestCommitTime (bareRepo1Path )
17
assert .NoError (t , err )
17
assert .NoError (t , err )
18
- // Time is in the past
18
+ // Time is Sun Jul 21 22:43:13 2019 +0200
19
- now := time .Now ()
20
- assert .True (t , lct .Unix () < now .Unix (), "%d not smaller than %d" , lct , now )
21
- // Time is after Mon Oct 23 03:52:09 2017 +0300
22
// which is the time of commit
19
// which is the time of commit
23
- // d47b98c44c9a6472e44ab80efe65235e11c6da2a
20
+ // feaf4ba6bc635fec442f46ddd4512416ec43c2c2 (refs/heads/master)
24
- refTime , err := time .Parse ("Mon Jan 02 15:04:05 2006 -0700" , "Mon Oct 23 03:52:09 2017 +0300" )
21
+ assert .EqualValues (t , 1563741793 , lct .Unix ())
25
- assert .NoError (t , err )
26
- assert .True (t , lct .Unix () > refTime .Unix (), "%d not greater than %d" , lct , refTime )
27
}
22
}
28
23
29
func TestRepoIsEmpty (t * testing.T ) {
24
func TestRepoIsEmpty (t * testing.T ) {
0 commit comments