Skip to content

Commit ccfda05

Browse files
Merge branch 'main' into feat-version-arch
2 parents d9c9b6b + 13dbd26 commit ccfda05

File tree

114 files changed

+1508
-1175
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+1508
-1175
lines changed

.eslintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ module.exports = {
403403
'github/a11y-svg-has-accessible-name': [0],
404404
'github/array-foreach': [0],
405405
'github/async-currenttarget': [2],
406-
'github/async-preventdefault': [2],
406+
'github/async-preventdefault': [0], // https://github.com/github/eslint-plugin-github/issues/599
407407
'github/authenticity-token': [0],
408408
'github/get-attribute': [0],
409409
'github/js-class-name': [0],

flake.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,14 @@
2929
poetry
3030

3131
# backend
32+
go_1_23
3233
gofumpt
3334
sqlite
3435
];
36+
shellHook = ''
37+
export GO="${pkgs.go_1_23}/bin/go"
38+
export GOROOT="${pkgs.go_1_23}/share/go"
39+
'';
3540
};
3641
}
3742
);

models/fixtures/access.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,9 @@
171171
user_id: 40
172172
repo_id: 61
173173
mode: 4
174+
175+
-
176+
id: 30
177+
user_id: 40
178+
repo_id: 1
179+
mode: 2

models/git/branch.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,8 @@ type FindRecentlyPushedNewBranchesOptions struct {
440440
}
441441

442442
type RecentlyPushedNewBranch struct {
443+
BranchRepo *repo_model.Repository
444+
BranchName string
443445
BranchDisplayName string
444446
BranchLink string
445447
BranchCompareURL string
@@ -540,7 +542,9 @@ func FindRecentlyPushedNewBranches(ctx context.Context, doer *user_model.User, o
540542
branchDisplayName = fmt.Sprintf("%s:%s", branch.Repo.FullName(), branchDisplayName)
541543
}
542544
newBranches = append(newBranches, &RecentlyPushedNewBranch{
545+
BranchRepo: branch.Repo,
543546
BranchDisplayName: branchDisplayName,
547+
BranchName: branch.Name,
544548
BranchLink: fmt.Sprintf("%s/src/branch/%s", branch.Repo.Link(), util.PathEscapeSegments(branch.Name)),
545549
BranchCompareURL: branch.Repo.ComposeBranchCompareURL(opts.BaseRepo, branch.Name),
546550
CommitTime: branch.CommitTime,

models/issues/stopwatch.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@ func (s Stopwatch) Seconds() int64 {
4646
return int64(timeutil.TimeStampNow() - s.CreatedUnix)
4747
}
4848

49-
// Duration returns a human-readable duration string based on local server time
50-
func (s Stopwatch) Duration() string {
51-
return util.SecToTime(s.Seconds())
52-
}
53-
5449
func getStopwatch(ctx context.Context, userID, issueID int64) (sw *Stopwatch, exists bool, err error) {
5550
sw = new(Stopwatch)
5651
exists, err = db.GetEngine(ctx).
@@ -201,7 +196,7 @@ func FinishIssueStopwatch(ctx context.Context, user *user_model.User, issue *Iss
201196
Doer: user,
202197
Issue: issue,
203198
Repo: issue.Repo,
204-
Content: util.SecToTime(timediff),
199+
Content: util.SecToHours(timediff),
205200
Type: CommentTypeStopTracking,
206201
TimeID: tt.ID,
207202
}); err != nil {

modules/git/diff.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ func GetRepoRawDiffForFile(repo *Repository, startCommit, endCommit string, diff
6464
} else if commit.ParentCount() == 0 {
6565
cmd.AddArguments("show").AddDynamicArguments(endCommit).AddDashesAndList(files...)
6666
} else {
67-
c, _ := commit.Parent(0)
67+
c, err := commit.Parent(0)
68+
if err != nil {
69+
return err
70+
}
6871
cmd.AddArguments("diff", "-M").AddDynamicArguments(c.ID.String(), endCommit).AddDashesAndList(files...)
6972
}
7073
case RawDiffPatch:
@@ -74,7 +77,10 @@ func GetRepoRawDiffForFile(repo *Repository, startCommit, endCommit string, diff
7477
} else if commit.ParentCount() == 0 {
7578
cmd.AddArguments("format-patch", "--no-signature", "--stdout", "--root").AddDynamicArguments(endCommit).AddDashesAndList(files...)
7679
} else {
77-
c, _ := commit.Parent(0)
80+
c, err := commit.Parent(0)
81+
if err != nil {
82+
return err
83+
}
7884
query := fmt.Sprintf("%s...%s", endCommit, c.ID.String())
7985
cmd.AddArguments("format-patch", "--no-signature", "--stdout").AddDynamicArguments(query).AddDashesAndList(files...)
8086
}

modules/git/repo_branch_gogit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func (repo *Repository) IsBranchExist(name string) bool {
5757

5858
// GetBranches returns branches from the repository, skipping "skip" initial branches and
5959
// returning at most "limit" branches, or all branches if "limit" is 0.
60-
// Branches are returned with sort of `-commiterdate` as the nogogit
60+
// Branches are returned with sort of `-committerdate` as the nogogit
6161
// implementation. This requires full fetch, sort and then the
6262
// skip/limit applies later as gogit returns in undefined order.
6363
func (repo *Repository) GetBranchNames(skip, limit int) ([]string, int, error) {

modules/repository/branch.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package repository
66
import (
77
"context"
88
"fmt"
9-
"strings"
109

1110
"code.gitea.io/gitea/models/db"
1211
git_model "code.gitea.io/gitea/models/git"
@@ -52,9 +51,6 @@ func SyncRepoBranchesWithRepo(ctx context.Context, repo *repo_model.Repository,
5251
{
5352
branches, _, err := gitRepo.GetBranchNames(0, 0)
5453
if err != nil {
55-
if strings.Contains(err.Error(), "ref file is empty") {
56-
return 0, nil
57-
}
5854
return 0, err
5955
}
6056
log.Trace("SyncRepoBranches[%s]: branches[%d]: %v", repo.FullName(), len(branches), branches)

modules/templates/helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func NewFuncMap() template.FuncMap {
6969
// time / number / format
7070
"FileSize": base.FileSize,
7171
"CountFmt": countFmt,
72-
"Sec2Time": util.SecToTime,
72+
"Sec2Time": util.SecToHours,
7373

7474
"TimeEstimateString": timeEstimateString,
7575

0 commit comments

Comments
 (0)