code.gitea.io/gitea@v1.22.3/modules/git/pipeline/lfs_common.go (about)

     1  // Copyright 2024 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package pipeline
     5  
     6  import (
     7  	"fmt"
     8  	"time"
     9  
    10  	"code.gitea.io/gitea/modules/git"
    11  )
    12  
    13  // LFSResult represents commits found using a provided pointer file hash
    14  type LFSResult struct {
    15  	Name           string
    16  	SHA            string
    17  	Summary        string
    18  	When           time.Time
    19  	ParentHashes   []git.ObjectID
    20  	BranchName     string
    21  	FullCommitName string
    22  }
    23  
    24  type lfsResultSlice []*LFSResult
    25  
    26  func (a lfsResultSlice) Len() int           { return len(a) }
    27  func (a lfsResultSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
    28  func (a lfsResultSlice) Less(i, j int) bool { return a[j].When.After(a[i].When) }
    29  
    30  func lfsError(msg string, err error) error {
    31  	return fmt.Errorf("LFS error occurred, %s: err: %w", msg, err)
    32  }