aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-03-22 19:17:30 +0800
committerGitHub <noreply@github.com>2024-03-22 19:17:30 +0800
commit226231ea27d4f2b0f09fa4efb39501507613b284 (patch)
treef7a45b173d4c96ff34c3fe7e7da8c73dce8a4ae3 /routers/web/repo
parent2f060c5834d81f0317c795fc281f9a07e03e5962 (diff)
downloadgitea-226231ea27d4f2b0f09fa4efb39501507613b284.tar.gz
gitea-226231ea27d4f2b0f09fa4efb39501507613b284.zip
Fix some pending problems (#29985)
These changes are quite independent and trivial, so I don't want to open too many PRs. * https://github.com/go-gitea/gitea/pull/29882#discussion_r1529607091 * the `f.Close` should be called properly * the error message could be more meaningful (https://github.com/go-gitea/gitea/pull/29882#pullrequestreview-1942557935) * https://github.com/go-gitea/gitea/pull/29859#pullrequestreview-1942324716 * the new translation strings don't take arguments * https://github.com/go-gitea/gitea/pull/28710#discussion_r1443778807 * stale for long time * #28140 * a form was forgotten to be changed to work with backend code
Diffstat (limited to 'routers/web/repo')
-rw-r--r--routers/web/repo/compare.go5
-rw-r--r--routers/web/repo/editor.go4
2 files changed, 4 insertions, 5 deletions
diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go
index bf42b77b66..7b5243e6b7 100644
--- a/routers/web/repo/compare.go
+++ b/routers/web/repo/compare.go
@@ -980,9 +980,8 @@ func getExcerptLines(commit *git.Commit, filePath string, idxLeft, idxRight, chu
}
diffLines = append(diffLines, diffLine)
}
- err = scanner.Err()
- if err != nil {
- return nil, fmt.Errorf("scan: %w", err)
+ if err = scanner.Err(); err != nil {
+ return nil, fmt.Errorf("getExcerptLines scan: %w", err)
}
return diffLines, nil
}
diff --git a/routers/web/repo/editor.go b/routers/web/repo/editor.go
index 29395b4013..082666276a 100644
--- a/routers/web/repo/editor.go
+++ b/routers/web/repo/editor.go
@@ -333,9 +333,9 @@ func editFilePost(ctx *context.Context, form forms.EditRepoFileForm, isNewFile b
ctx.Error(http.StatusInternalServerError, err.Error())
}
} else if models.IsErrCommitIDDoesNotMatch(err) {
- ctx.RenderWithErr(ctx.Tr("repo.editor.commit_id_not_matching", ctx.Repo.RepoLink+"/compare/"+util.PathEscapeSegments(form.LastCommit)+"..."+util.PathEscapeSegments(ctx.Repo.CommitID)), tplEditFile, &form)
+ ctx.RenderWithErr(ctx.Tr("repo.editor.commit_id_not_matching"), tplEditFile, &form)
} else if git.IsErrPushOutOfDate(err) {
- ctx.RenderWithErr(ctx.Tr("repo.editor.push_out_of_date", ctx.Repo.RepoLink+"/compare/"+util.PathEscapeSegments(form.LastCommit)+"..."+util.PathEscapeSegments(form.NewBranchName)), tplEditFile, &form)
+ ctx.RenderWithErr(ctx.Tr("repo.editor.push_out_of_date"), tplEditFile, &form)
} else if git.IsErrPushRejected(err) {
errPushRej := err.(*git.ErrPushRejected)
if len(errPushRej.Message) == 0 {