-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deduplicate lfs common code (#30704)
- Loading branch information
1 parent
2a3906d
commit ed8c63c
Showing
3 changed files
with
42 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2024 The Gitea Authors. All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package pipeline | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
|
||
"code.gitea.io/gitea/modules/git" | ||
) | ||
|
||
// LFSResult represents commits found using a provided pointer file hash | ||
type LFSResult struct { | ||
Name string | ||
SHA string | ||
Summary string | ||
When time.Time | ||
ParentHashes []git.ObjectID | ||
BranchName string | ||
FullCommitName string | ||
} | ||
|
||
type lfsResultSlice []*LFSResult | ||
|
||
func (a lfsResultSlice) Len() int { return len(a) } | ||
func (a lfsResultSlice) Swap(i, j int) { a[i], a[j] = a[j], a[i] } | ||
func (a lfsResultSlice) Less(i, j int) bool { return a[j].When.After(a[i].When) } | ||
|
||
func lfsError(msg string, err error) error { | ||
return fmt.Errorf("LFS error occurred, %s: err: %w", msg, err) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters