@@ -243,36 +243,6 @@ func GetLatestCommitTime(ctx context.Context, repoPath string) (time.Time, error
243
243
return time .Parse ("Mon Jan _2 15:04:05 2006 -0700" , commitTime )
244
244
}
245
245
246
- // DivergeObject represents commit count diverging commits
247
- type DivergeObject struct {
248
- Ahead int
249
- Behind int
250
- }
251
-
252
- // GetDivergingCommits returns the number of commits a targetBranch is ahead or behind a baseBranch
253
- func GetDivergingCommits (ctx context.Context , repoPath , baseBranch , targetBranch string ) (do DivergeObject , err error ) {
254
- cmd := gitcmd .NewCommand ("rev-list" , "--count" , "--left-right" ).
255
- AddDynamicArguments (baseBranch + "..." + targetBranch ).AddArguments ("--" )
256
- stdout , _ , err := cmd .RunStdString (ctx , & gitcmd.RunOpts {Dir : repoPath })
257
- if err != nil {
258
- return do , err
259
- }
260
- left , right , found := strings .Cut (strings .Trim (stdout , "\n " ), "\t " )
261
- if ! found {
262
- return do , fmt .Errorf ("git rev-list output is missing a tab: %q" , stdout )
263
- }
264
-
265
- do .Behind , err = strconv .Atoi (left )
266
- if err != nil {
267
- return do , err
268
- }
269
- do .Ahead , err = strconv .Atoi (right )
270
- if err != nil {
271
- return do , err
272
- }
273
- return do , nil
274
- }
275
-
276
246
// CreateBundle create bundle content to the target path
277
247
func (repo * Repository ) CreateBundle (ctx context.Context , commit string , out io.Writer ) error {
278
248
tmp , cleanup , err := setting .AppDataTempDir ("git-repo-content" ).MkdirTempRandom ("gitea-bundle" )
0 commit comments