0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-02-20 21:06:00 -05:00

chore: Remove TemporaryUploadRepository.GetLastCommit

- Introduced in 2262811e40 and removed in
the same commit. Never used.
This commit is contained in:
Gusted 2025-01-31 11:12:31 +01:00
parent 6062ba36f2
commit 552cfe75f5
No known key found for this signature in database
GPG key ID: FD821B732837125F
2 changed files with 0 additions and 20 deletions

View file

@ -265,8 +265,6 @@ code.gitea.io/gitea/services/repository
code.gitea.io/gitea/services/repository/files
ContentType.String
GetFileResponseFromCommit
TemporaryUploadRepository.GetLastCommit
TemporaryUploadRepository.GetLastCommitByRef
code.gitea.io/gitea/services/webhook
NewNotifier

View file

@ -212,24 +212,6 @@ func (t *TemporaryUploadRepository) WriteTree() (string, error) {
return strings.TrimSpace(stdout), nil
}
// GetLastCommit gets the last commit ID SHA of the repo
func (t *TemporaryUploadRepository) GetLastCommit() (string, error) {
return t.GetLastCommitByRef("HEAD")
}
// GetLastCommitByRef gets the last commit ID SHA of the repo by ref
func (t *TemporaryUploadRepository) GetLastCommitByRef(ref string) (string, error) {
if ref == "" {
ref = "HEAD"
}
stdout, _, err := git.NewCommand(t.ctx, "rev-parse").AddDynamicArguments(ref).RunStdString(&git.RunOpts{Dir: t.basePath})
if err != nil {
log.Error("Unable to get last ref for %s in temporary repo: %s(%s): Error: %v", ref, t.repo.FullName(), t.basePath, err)
return "", fmt.Errorf("Unable to rev-parse %s in temporary repo for: %s Error: %w", ref, t.repo.FullName(), err)
}
return strings.TrimSpace(stdout), nil
}
// CommitTree creates a commit from a given tree for the user with provided message
func (t *TemporaryUploadRepository) CommitTree(parent string, author, committer *user_model.User, treeHash, message string, signoff bool) (string, error) {
return t.CommitTreeWithDate(parent, author, committer, treeHash, message, signoff, time.Now(), time.Now())