@@ -123,23 +123,23 @@ func getDivergenceCacheKey(repoID int64, branchName string) string {
123
123
}
124
124
125
125
// getDivergenceFromCache gets the divergence from cache
126
- func getDivergenceFromCache (repoID int64 , branchName string ) (* git .DivergeObject , bool ) {
126
+ func getDivergenceFromCache (repoID int64 , branchName string ) (* gitrepo .DivergeObject , bool ) {
127
127
data , ok := cache .GetCache ().Get (getDivergenceCacheKey (repoID , branchName ))
128
- res := git .DivergeObject {
128
+ res := & gitrepo .DivergeObject {
129
129
Ahead : - 1 ,
130
130
Behind : - 1 ,
131
131
}
132
132
if ! ok || data == "" {
133
- return & res , false
133
+ return res , false
134
134
}
135
135
if err := json .Unmarshal (util .UnsafeStringToBytes (data ), & res ); err != nil {
136
136
log .Error ("json.UnMarshal failed: %v" , err )
137
- return & res , false
137
+ return res , false
138
138
}
139
- return & res , true
139
+ return res , true
140
140
}
141
141
142
- func putDivergenceFromCache (repoID int64 , branchName string , divergence * git .DivergeObject ) error {
142
+ func putDivergenceFromCache (repoID int64 , branchName string , divergence * gitrepo .DivergeObject ) error {
143
143
bs , err := json .Marshal (divergence )
144
144
if err != nil {
145
145
return err
@@ -178,7 +178,7 @@ func loadOneBranch(ctx context.Context, repo *repo_model.Repository, dbBranch *g
178
178
p := protectedBranches .GetFirstMatched (branchName )
179
179
isProtected := p != nil
180
180
181
- var divergence * git .DivergeObject
181
+ var divergence * gitrepo .DivergeObject
182
182
183
183
// it's not default branch
184
184
if repo .DefaultBranch != dbBranch .Name && ! dbBranch .IsDeleted {
@@ -199,7 +199,7 @@ func loadOneBranch(ctx context.Context, repo *repo_model.Repository, dbBranch *g
199
199
200
200
if divergence == nil {
201
201
// tolerate the error that we cannot get divergence
202
- divergence = & git .DivergeObject {Ahead : - 1 , Behind : - 1 }
202
+ divergence = & gitrepo .DivergeObject {Ahead : - 1 , Behind : - 1 }
203
203
}
204
204
205
205
pr , err := issues_model .GetLatestPullRequestByHeadInfo (ctx , repo .ID , branchName )
@@ -720,7 +720,7 @@ func GetBranchDivergingInfo(ctx reqctx.RequestContext, baseRepo *repo_model.Repo
720
720
// if the fork repo has new commits, this call will fail because they are not in the base repo
721
721
// exit status 128 - fatal: Invalid symmetric difference expression aaaaaaaaaaaa...bbbbbbbbbbbb
722
722
// so at the moment, we first check the update time, then check whether the fork branch has base's head
723
- diff , err := git .GetDivergingCommits (ctx , baseRepo . RepoPath () , baseGitBranch .CommitID , headGitBranch .CommitID )
723
+ diff , err := gitrepo .GetDivergingCommits (ctx , baseRepo , baseGitBranch .CommitID , headGitBranch .CommitID )
724
724
if err != nil {
725
725
info .BaseHasNewCommits = baseGitBranch .UpdatedUnix > headGitBranch .UpdatedUnix
726
726
if headRepo .IsFork && info .BaseHasNewCommits {
0 commit comments