mirror of
https://github.com/go-gitea/gitea.git
synced 2026-07-15 20:40:52 +09:00
chore: fix git commit "rev-list" (#38069)
Fix the copied & pasted messy code, fix #38067 Now, "limit=-1" means "no limit"
This commit is contained in:
@@ -20,8 +20,8 @@ import (
|
||||
// SyncResult describes a reference update detected during sync.
|
||||
type SyncResult struct {
|
||||
RefName git.RefName
|
||||
OldCommitID string
|
||||
NewCommitID string
|
||||
OldCommitID git.RefName
|
||||
NewCommitID git.RefName
|
||||
}
|
||||
|
||||
// SyncRepoBranches synchronizes branch table with repository branches
|
||||
@@ -104,7 +104,7 @@ func SyncRepoBranchesWithRepo(ctx context.Context, repo *repo_model.Repository,
|
||||
syncResults = append(syncResults, &SyncResult{
|
||||
RefName: git.RefNameFromBranch(branch),
|
||||
OldCommitID: "",
|
||||
NewCommitID: commit.ID.String(),
|
||||
NewCommitID: commit.ID.RefName(),
|
||||
})
|
||||
} else if commit.ID.String() != dbb.CommitID || dbb.IsDeleted {
|
||||
toUpdate = append(toUpdate, &git_model.Branch{
|
||||
@@ -118,8 +118,8 @@ func SyncRepoBranchesWithRepo(ctx context.Context, repo *repo_model.Repository,
|
||||
})
|
||||
syncResults = append(syncResults, &SyncResult{
|
||||
RefName: git.RefNameFromBranch(branch),
|
||||
OldCommitID: dbb.CommitID,
|
||||
NewCommitID: commit.ID.String(),
|
||||
OldCommitID: git.RefNameFromCommit(dbb.CommitID),
|
||||
NewCommitID: commit.ID.RefName(),
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,7 @@ func SyncRepoBranchesWithRepo(ctx context.Context, repo *repo_model.Repository,
|
||||
toRemove = append(toRemove, dbBranch.ID)
|
||||
syncResults = append(syncResults, &SyncResult{
|
||||
RefName: git.RefNameFromBranch(dbBranch.Name),
|
||||
OldCommitID: dbBranch.CommitID,
|
||||
OldCommitID: git.RefNameFromCommit(dbBranch.CommitID),
|
||||
NewCommitID: "",
|
||||
})
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ func SyncReleasesWithTags(ctx context.Context, repo *repo_model.Repository, gitR
|
||||
syncResults = append(syncResults, &SyncResult{
|
||||
RefName: git.RefNameFromTag(tag.Name),
|
||||
OldCommitID: "",
|
||||
NewCommitID: tag.Object.String(),
|
||||
NewCommitID: tag.Object.RefName(),
|
||||
})
|
||||
}
|
||||
for _, deleteID := range deletes {
|
||||
@@ -220,20 +220,20 @@ func SyncReleasesWithTags(ctx context.Context, repo *repo_model.Repository, gitR
|
||||
}
|
||||
syncResults = append(syncResults, &SyncResult{
|
||||
RefName: git.RefNameFromTag(release.TagName),
|
||||
OldCommitID: release.Sha1,
|
||||
OldCommitID: git.RefNameFromCommit(release.Sha1),
|
||||
NewCommitID: "",
|
||||
})
|
||||
}
|
||||
for _, tag := range updates {
|
||||
release := dbReleasesByTag[tag.Name]
|
||||
oldSha := ""
|
||||
var oldCommitID git.RefName
|
||||
if release != nil {
|
||||
oldSha = release.Sha1
|
||||
oldCommitID = git.RefNameFromCommit(release.Sha1)
|
||||
}
|
||||
syncResults = append(syncResults, &SyncResult{
|
||||
RefName: git.RefNameFromTag(tag.Name),
|
||||
OldCommitID: oldSha,
|
||||
NewCommitID: tag.Object.String(),
|
||||
OldCommitID: oldCommitID,
|
||||
NewCommitID: tag.Object.RefName(),
|
||||
})
|
||||
}
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user