diff --git a/cmd/web.go b/cmd/web.go
index 9c7ddb57d..8c46bedbe 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -494,17 +494,17 @@ func runWeb(ctx *cli.Context) error {
Post(bindIgnErr(auth.CreateIssueForm{}), repo.CompareAndPullRequestPost)
m.Group("", func() {
- m.Combo("/edit/*").Get(repo.EditFile).
+ m.Combo("/_edit/*").Get(repo.EditFile).
Post(bindIgnErr(auth.EditRepoFileForm{}), repo.EditFilePost)
- m.Combo("/new/*").Get(repo.EditNewFile).
- Post(bindIgnErr(auth.EditRepoFileForm{}), repo.EditNewFilePost)
+ m.Combo("/_new/*").Get(repo.NewFile).
+ Post(bindIgnErr(auth.EditRepoFileForm{}), repo.NewFilePost)
m.Post("/preview/*", bindIgnErr(auth.EditPreviewDiffForm{}), repo.DiffPreviewPost)
m.Combo("/upload/*").Get(repo.UploadFile).
Post(bindIgnErr(auth.UploadRepoFileForm{}), repo.UploadFilePost)
m.Post("/delete/*", bindIgnErr(auth.DeleteRepoFileForm{}), repo.DeleteFilePost)
m.Post("/branches", bindIgnErr(auth.NewBranchForm{}), repo.NewBranchPost)
m.Post("/upload-file", repo.UploadFileToServer)
- m.Post("/upload-remove", bindIgnErr(auth.UploadRemoveFileForm{}), repo.UploadRemoveFileFromServer)
+ m.Post("/upload-remove", bindIgnErr(auth.RemoveUploadFileForm{}), repo.RemoveUploadFileFromServer)
}, context.RepoRef(), context.RepoAssignment(), reqRepoWriter)
}, reqSignIn, context.RepoAssignment(), repo.MustBeNotBare)
diff --git a/conf/app.ini b/conf/app.ini
index 8f31e64e3..b18dbcedc 100644
--- a/conf/app.ini
+++ b/conf/app.ini
@@ -23,22 +23,22 @@ PULL_REQUEST_QUEUE_LENGTH = 10000
[editor]
; List of file extensions that should have line wraps in the CodeMirror editor
; Separate extensions with a comma. To line wrap files w/o extension, just put a comma
-LINE_WRAP_EXTENSIONS = .txt,.md,.markdown,.mdown,.mkd,,
+LINE_WRAP_EXTENSIONS = .txt,.md,.markdown,.mdown,.mkd,
; Valid file modes that have a preview API associated with them, such as api/v1/markdown
; Separate values by commas. Preview tab in edit mode won't show if the file extension doesn't match
PREVIEW_TAB_APIS = markdown
[upload]
-; Whether uploads are enabled. Defaults to `true`
+; Whether repository file uploads are enabled. Defaults to `true`
ENABLE_UPLOADS = true
; Path for uploads. Defaults to `data/tmp/uploads` (tmp gets deleted on gogs restart)
-UPLOAD_TEMP_PATH = data/tmp/uploads
+TEMP_PATH = data/tmp/uploads
; One or more allowed types, e.g. image/jpeg|image/png. Nothing means any file type
-UPLOAD_ALLOWED_TYPES =
+ALLOWED_TYPES =
; Max size of each file in MB. Defaults to 32MB
-UPLOAD_FILE_MAX_SIZE = 32
+FILE_MAX_SIZE = 32
; Max number of files per upload. Defaults to 10
-UPLOAD_MAX_FILES = 10
+MAX_FILES = 10
[ui]
; Number of repositories that are showed in one explore page
diff --git a/conf/locale/locale_en-US.ini b/conf/locale/locale_en-US.ini
index e4460328f..cded3f8df 100644
--- a/conf/locale/locale_en-US.ini
+++ b/conf/locale/locale_en-US.ini
@@ -428,7 +428,7 @@ new_file = New file
upload_files = Upload files
find_file = Find file
commit_changes = Commit Changes
-default_commit_message = Add an optional extended description…
+default_commit_message = Add an optional extended description...
last_commit_info = %s edited this file %s
delete_this_file = Delete this file
edit_this_file = Edit this file
@@ -457,8 +457,8 @@ from = from
upload_file = Upload file
add_files_to_dir = Add files to %s
unable_to_upload_files = Unable to upload files, an error occurred.
-add_subdir = Add subdirectory…
-name_your_file = Name your file…
+add_subdir = Add subdirectory...
+name_your_file = Name your file...
user_has_committed_since_you_started_editing = %s has committed since you started editing.
see_what_changed = See what changed.
pressing_commit_again_will_overwrite_those_changes = Pressing '%s' again will overwrite those changes.
@@ -489,7 +489,7 @@ issues.new.clear_assignee = Clear assignee
issues.new.no_assignee = No assignee
issues.create = Create Issue
issues.new_label = New Label
-issues.new_label_placeholder = Label name…
+issues.new_label_placeholder = Label name...
issues.create_label = Create Label
issues.open_tab = %d Open
issues.close_tab = %d Closed
@@ -676,7 +676,7 @@ settings.delete_collaborator = Delete
settings.collaborator_deletion = Collaborator Deletion
settings.collaborator_deletion_desc = This user will no longer have collaboration access to this repository after deletion. Do you want to continue?
settings.remove_collaborator_success = Collaborator has been removed.
-settings.search_user_placeholder = Search user…
+settings.search_user_placeholder = Search user...
settings.org_not_allowed_to_be_collaborator = Organization is not allowed to be added as a collaborator.
settings.user_is_org_member = User is organization member who cannot be added as a collaborator.
settings.add_webhook = Add Webhook
@@ -768,7 +768,7 @@ release.title = Title
release.content = Content
release.write = Write
release.preview = Preview
-release.loading = Loading…
+release.loading = Loading...
release.prerelease_desc = This is a pre-release
release.prerelease_helper = We'll point out that this release is not production-ready.
release.cancel = Cancel
@@ -857,7 +857,7 @@ teams.read_permission_desc = This team grants Read access: memb
teams.write_permission_desc = This team grants Write access: members can read from and push to the team's repositories.
teams.admin_permission_desc = This team grants Admin access: members can read from, push to, and add collaborators to the team's repositories.
teams.repositories = Team Repositories
-teams.search_repo_placeholder = Search repository…
+teams.search_repo_placeholder = Search repository...
teams.add_team_repository = Add Team Repository
teams.remove_repo = Remove
teams.add_nonexistent_repo = The repository you're trying to add does not exist, please create it first.
diff --git a/models/error.go b/models/error.go
index 9ab044a2f..82e98f58d 100644
--- a/models/error.go
+++ b/models/error.go
@@ -427,7 +427,7 @@ func IsErrRepoFileAlreadyExist(err error) bool {
}
func (err ErrRepoFileAlreadyExist) Error() string {
- return fmt.Sprintf("Repo file already exists [file name: %s]", err.FileName)
+ return fmt.Sprintf("repository file already exists [file name: %s]", err.FileName)
}
// __________ .__
diff --git a/models/issue.go b/models/issue.go
index e613418d0..a3d8570e3 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -425,7 +425,6 @@ func NewIssue(repo *Repository, issue *Issue, labelIDs []int64, uuids []string)
act := &Action{
ActUserID: issue.Poster.ID,
ActUserName: issue.Poster.Name,
-
ActEmail: issue.Poster.Email,
OpType: ACTION_CREATE_ISSUE,
Content: fmt.Sprintf("%d|%s", issue.Index, issue.Name),
diff --git a/models/repo.go b/models/repo.go
index 0a03eddbe..3a5362d6a 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -9,7 +9,9 @@ import (
"errors"
"fmt"
"html/template"
+ "io"
"io/ioutil"
+ "mime/multipart"
"os"
"os/exec"
"path"
@@ -35,8 +37,6 @@ import (
"github.com/gogits/gogs/modules/markdown"
"github.com/gogits/gogs/modules/process"
"github.com/gogits/gogs/modules/setting"
- "mime/multipart"
- "io"
)
const (
@@ -412,7 +412,7 @@ func updateLocalCopy(repoPath, localPath, branch string) error {
if !com.IsExist(localPath) {
if err := git.Clone(repoPath, localPath, git.CloneRepoOptions{
Timeout: time.Duration(setting.Git.Timeout.Clone) * time.Second,
- Branch: branch,
+ Branch: branch,
}); err != nil {
return fmt.Errorf("Clone: %v", err)
}
@@ -2223,14 +2223,14 @@ func (repo *Repository) CheckoutNewBranch(oldBranchName, newBranchName string) e
func checkoutNewBranch(repoPath, localPath, oldBranch, newBranch string) error {
if !com.IsExist(localPath) {
- if error := updateLocalCopy(repoPath, localPath, oldBranch); error != nil {
- return error
+ if err := updateLocalCopy(repoPath, localPath, oldBranch); error != nil {
+ return err
}
}
- if err := git.Checkout(localPath, git.CheckoutOptions {
- Branch: newBranch,
+ if err := git.Checkout(localPath, git.CheckoutOptions{
+ Branch: newBranch,
OldBranch: oldBranch,
- Timeout: time.Duration(setting.Git.Timeout.Pull) * time.Second,
+ Timeout: time.Duration(setting.Git.Timeout.Pull) * time.Second,
}); err != nil {
return fmt.Errorf("Checkout New Branch: %v", err)
}
@@ -2248,7 +2248,7 @@ func (repo *Repository) UpdateRepoFile(doer *User, oldBranchName, branchName, ol
return fmt.Errorf("UpdateLocalRepo: %s - %v", oldBranchName, err)
}
- if( oldBranchName != branchName ){
+ if oldBranchName != branchName {
if err := repo.CheckoutNewBranch(oldBranchName, branchName); err != nil {
return fmt.Errorf("CheckoutNewBranch: %s - %s: %v", oldBranchName, branchName, err)
}
@@ -2265,16 +2265,14 @@ func (repo *Repository) UpdateRepoFile(doer *User, oldBranchName, branchName, ol
}
}
- if ! com.IsExist(filepath.Dir(filePath)) {
- os.MkdirAll(filepath.Dir(filePath), os.ModePerm)
- }
+ os.MkdirAll(filepath.Dir(filePath), os.ModePerm)
// If new file, make sure it doesn't exist; if old file, move if file name change
if isNewFile {
if com.IsExist(filePath) {
return ErrRepoFileAlreadyExist{filePath}
}
- } else if oldTreeName!="" && treeName!="" && treeName != oldTreeName {
+ } else if oldTreeName != "" && treeName != "" && treeName != oldTreeName {
if err = git.MoveFile(localPath, oldTreeName, treeName); err != nil {
return fmt.Errorf("MoveFile: %v", err)
}
@@ -2308,9 +2306,7 @@ func (repo *Repository) GetPreviewDiff(repoPath, branchName, treeName, text stri
localPath := repo.LocalRepoPath()
filePath := path.Join(localPath, treeName)
- if ! com.IsExist(filepath.Dir(filePath)) {
- os.MkdirAll(filepath.Dir(filePath), os.ModePerm)
- }
+ os.MkdirAll(filepath.Dir(filePath), os.ModePerm)
if err = ioutil.WriteFile(filePath, []byte(text), 0666); err != nil {
return nil, fmt.Errorf("WriteFile: %v", err)
@@ -2403,19 +2399,17 @@ func (repo *Repository) UploadRepoFiles(doer *User, oldBranchName, branchName, t
return fmt.Errorf("UpdateLocalRepo: %v", err)
}
- if( oldBranchName != branchName ){
+ if oldBranchName != branchName {
repo.CheckoutNewBranch(oldBranchName, branchName)
}
dirPath := path.Join(localPath, treeName)
- if ! com.IsExist(dirPath) {
- os.MkdirAll(dirPath, os.ModePerm)
- }
+ os.MkdirAll(dirPath, os.ModePerm)
// Copy uploaded files into repository.
for _, uuid := range uuids {
- upload, err := getUpload(uuid, doer.Id, repo.ID)
+ upload, err := getUpload(uuid, doer.ID, repo.ID)
if err != nil {
if IsErrUploadNotExist(err) {
continue
@@ -2423,12 +2417,12 @@ func (repo *Repository) UploadRepoFiles(doer *User, oldBranchName, branchName, t
return fmt.Errorf("getUpload[%s]: %v", uuid, err)
}
uuidPath := upload.LocalPath()
- filePath := dirPath+"/"+upload.Name
+ filePath := dirPath + "/" + upload.Name
if err := os.Rename(uuidPath, filePath); err != nil {
- DeleteUpload(upload, true);
+ DeleteUpload(upload, true)
return fmt.Errorf("Rename[%s -> %s]: %v", uuidPath, filePath, err)
}
- DeleteUpload(upload, false); // false because we have moved the file
+ DeleteUpload(upload, false) // false because we have moved the file
}
if len(message) == 0 {
@@ -2448,11 +2442,11 @@ func (repo *Repository) UploadRepoFiles(doer *User, oldBranchName, branchName, t
// Upload represent a uploaded file to a repo to be deleted when moved
type Upload struct {
- ID int64 `xorm:"pk autoincr"`
- UUID string `xorm:"uuid UNIQUE"`
- UID int64 `xorm:"INDEX"`
- RepoID int64 `xorm:"INDEX"`
- Name string
+ ID int64 `xorm:"pk autoincr"`
+ UUID string `xorm:"uuid UNIQUE"`
+ UID int64 `xorm:"INDEX"`
+ RepoID int64 `xorm:"INDEX"`
+ Name string
Created time.Time `xorm:"-"`
CreatedUnix int64
}
@@ -2483,7 +2477,7 @@ func NewUpload(name string, buf []byte, file multipart.File, userId, repoId int6
up := &Upload{
UUID: gouuid.NewV4().String(),
Name: name,
- UID: userId,
+ UID: userId,
RepoID: repoId,
}
@@ -2534,13 +2528,13 @@ func RemoveUpload(uuid string, userId, repoId int64) (err error) {
return nil
}
-func getUpload(uuid string, userId, repoId int64) (*Upload, error) {
- up := &Upload{UUID: uuid, UID: userId, RepoID: repoId}
+func getUpload(uuid string, userID, repoID int64) (*Upload, error) {
+ up := &Upload{UUID: uuid, UID: userID, RepoID: repoID}
has, err := x.Get(up)
if err != nil {
return nil, err
} else if !has {
- return nil, ErrUploadNotExist{0, uuid, userId, repoId}
+ return nil, ErrUploadNotExist{0, uuid, userID, repoID}
}
return up, nil
}
diff --git a/models/working_pool.go b/models/working_pool.go
index 3f2055baf..c522de56a 100644
--- a/models/working_pool.go
+++ b/models/working_pool.go
@@ -45,4 +45,3 @@ func (p *workingPool) CheckOut(name string) {
p.count[name]--
}
}
-
diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go
index 89780a716..6f6285b2d 100644
--- a/modules/auth/repo_form.go
+++ b/modules/auth/repo_form.go
@@ -277,13 +277,13 @@ func (f *NewWikiForm) Validate(ctx *macaron.Context, errs binding.Errors) bindin
// \/ \/
type EditRepoFileForm struct {
- TreeName string `binding:"Required;MaxSize(500)"`
- Content string `binding:"Required"`
+ TreeName string `binding:"Required;MaxSize(500)"`
+ Content string `binding:"Required"`
CommitSummary string `binding:"MaxSize(100)`
- CommitMessage string
- CommitChoice string `binding:"Required;MaxSize(50)"`
+ CommitMessage string
+ CommitChoice string `binding:"Required;MaxSize(50)"`
NewBranchName string `binding:"AlphaDashDot;MaxSize(100)"`
- LastCommit string
+ LastCommit string
}
func (f *EditRepoFileForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
@@ -291,7 +291,7 @@ func (f *EditRepoFileForm) Validate(ctx *macaron.Context, errs binding.Errors) b
}
type EditPreviewDiffForm struct {
- Content string
+ Content string
}
func (f *EditPreviewDiffForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
@@ -307,19 +307,19 @@ func (f *EditPreviewDiffForm) Validate(ctx *macaron.Context, errs binding.Errors
//
type UploadRepoFileForm struct {
- TreeName string `binding:MaxSize(500)"`
+ TreeName string `binding:MaxSize(500)"`
CommitSummary string `binding:"MaxSize(100)`
- CommitMessage string
- CommitChoice string `binding:"Required;MaxSize(50)"`
+ CommitMessage string
+ CommitChoice string `binding:"Required;MaxSize(50)"`
NewBranchName string `binding:"AlphaDashDot;MaxSize(100)"`
- Files []string
+ Files []string
}
func (f *UploadRepoFileForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
return validate(errs, ctx.Data, f, ctx.Locale)
}
-type UploadRemoveFileForm struct {
+type RemoveUploadFileForm struct {
File string `binding:"Required;MaxSize(50)"`
}
@@ -342,7 +342,6 @@ func (f *DeleteRepoFileForm) Validate(ctx *macaron.Context, errs binding.Errors)
return validate(errs, ctx.Data, f, ctx.Locale)
}
-
// __________ .__
// \______ \____________ ____ ____ | |__
// | | _/\_ __ \__ \ / \_/ ___\| | \
@@ -351,7 +350,7 @@ func (f *DeleteRepoFileForm) Validate(ctx *macaron.Context, errs binding.Errors)
// \/ \/ \/ \/ \/
type NewBranchForm struct {
OldBranchName string `binding:"Required;MaxSize(100)"`
- BranchName string `binding:"Required;MaxSize(100)"`
+ BranchName string `binding:"Required;MaxSize(100)"`
}
func (f *NewBranchForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 52039bc59..6e6761da4 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -116,8 +116,8 @@ var (
// Repo editor settings
Editor struct {
- LineWrapExtensions []string
- PreviewTabApis []string
+ LineWrapExtensions []string
+ PreviewTabApis []string
}
// UI settings
@@ -164,11 +164,11 @@ var (
AttachmentEnabled bool
// Repo Upload settings
- UploadTempPath string
- UploadAllowedTypes string
- UploadMaxSize int64
- UploadMaxFiles int
- UploadEnabled bool
+ UploadTempPath string
+ UploadAllowedTypes string
+ UploadMaxSize int64
+ UploadMaxFiles int
+ UploadEnabled bool
// Time settings
TimeFormat string
diff --git a/routers/repo/branch.go b/routers/repo/branch.go
index 51857e44b..371191902 100644
--- a/routers/repo/branch.go
+++ b/routers/repo/branch.go
@@ -5,13 +5,13 @@
package repo
import (
+ "github.com/gogits/gogs/models"
+ "github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/context"
- "github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/log"
- "strings"
"net/url"
- "github.com/gogits/gogs/models"
+ "strings"
)
const (
@@ -39,7 +39,7 @@ func NewBranchPost(ctx *context.Context, form auth.NewBranchForm) {
oldBranchName := form.OldBranchName
branchName := form.BranchName
- if ctx.HasError() || ! ctx.Repo.IsWriter() || branchName == oldBranchName {
+ if ctx.HasError() || !ctx.Repo.IsWriter() || branchName == oldBranchName {
ctx.Redirect(EscapeUrl(ctx.Repo.RepoLink + "/src/" + oldBranchName))
return
}
diff --git a/routers/repo/delete.go b/routers/repo/delete.go
index f804099ad..1ae4a88a2 100644
--- a/routers/repo/delete.go
+++ b/routers/repo/delete.go
@@ -5,10 +5,10 @@
package repo
import (
- "github.com/gogits/gogs/modules/context"
- "github.com/gogits/gogs/modules/auth"
- "github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/models"
+ "github.com/gogits/gogs/modules/auth"
+ "github.com/gogits/gogs/modules/context"
+ "github.com/gogits/gogs/modules/log"
)
func DeleteFilePost(ctx *context.Context, form auth.DeleteRepoFileForm) {
@@ -50,5 +50,5 @@ func DeleteFilePost(ctx *context.Context, form auth.DeleteRepoFileForm) {
models.HookQueue.Add(ctx.Repo.Repository.ID)
}
- ctx.Redirect(ctx.Repo.RepoLink+"/src/"+branchName)
+ ctx.Redirect(ctx.Repo.RepoLink + "/src/" + branchName)
}
diff --git a/routers/repo/edit.go b/routers/repo/edit.go
index b6322a9e7..bda94d60b 100644
--- a/routers/repo/edit.go
+++ b/routers/repo/edit.go
@@ -6,22 +6,22 @@ package repo
import (
"io/ioutil"
- "strings"
"path"
+ "strings"
"github.com/gogits/git-module"
+ "github.com/gogits/gogs/models"
+ "github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/context"
"github.com/gogits/gogs/modules/log"
- "github.com/gogits/gogs/modules/template"
- "github.com/gogits/gogs/modules/auth"
- "github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/setting"
+ "github.com/gogits/gogs/modules/template"
)
const (
- EDIT base.TplName = "repo/edit"
- DIFF_PREVIEW base.TplName = "repo/diff_preview"
+ EDIT base.TplName = "repo/edit"
+ DIFF_PREVIEW base.TplName = "repo/diff_preview"
DIFF_PREVIEW_NEW base.TplName = "repo/diff_preview_new"
)
@@ -29,7 +29,7 @@ func EditFile(ctx *context.Context) {
editFile(ctx, false)
}
-func EditNewFile(ctx *context.Context) {
+func NewFile(ctx *context.Context) {
editFile(ctx, true)
}
@@ -49,10 +49,10 @@ func editFile(ctx *context.Context, isNewFile bool) {
treeNames = strings.Split(treeName, "/")
}
- if ! isNewFile {
+ if !isNewFile {
entry, err := ctx.Repo.Commit.GetTreeEntryByPath(treeName)
- if err != nil && git.IsErrNotExist(err) {
+ if err != nil && git.IsErrNotExist(err) {
ctx.Handle(404, "GetTreeEntryByPath", err)
return
}
@@ -81,7 +81,7 @@ func editFile(ctx *context.Context, isNewFile bool) {
_, isTextFile := base.IsTextFile(buf)
- if ! isTextFile {
+ if !isTextFile {
ctx.Handle(404, "repo.Home", nil)
return
}
@@ -124,11 +124,11 @@ func editFile(ctx *context.Context, isNewFile bool) {
ctx.HTML(200, EDIT)
}
-func EditFilePost(ctx *context.Context, form auth.EditRepoFileForm) {
+func FilePost(ctx *context.Context, form auth.EditRepoFileForm) {
editFilePost(ctx, form, false)
}
-func EditNewFilePost(ctx *context.Context, form auth.EditRepoFileForm) {
+func NewFilePost(ctx *context.Context, form auth.EditRepoFileForm) {
editFilePost(ctx, form, true)
}
@@ -193,7 +193,7 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo
return
}
- if( oldBranchName != branchName ){
+ if oldBranchName != branchName {
if _, err := ctx.Repo.Repository.GetBranch(branchName); err == nil {
ctx.Data["Err_Branchname"] = true
ctx.RenderWithErr(ctx.Tr("repo.branch_already_exists"), EDIT, &form)
@@ -204,7 +204,7 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo
}
treepath := ""
- for index,part := range treeNames {
+ for index, part := range treeNames {
treepath = path.Join(treepath, part)
entry, err := ctx.Repo.Commit.GetTreeEntryByPath(treepath)
if err != nil {
@@ -212,7 +212,7 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo
break
}
if index != len(treeNames)-1 {
- if ! entry.IsDir() {
+ if !entry.IsDir() {
ctx.Data["Err_Filename"] = true
ctx.RenderWithErr(ctx.Tr("repo.directory_is_a_file"), EDIT, &form)
log.Error(4, "%s: %s - %s", "EditFile", treeName, "Directory given is a file")
@@ -228,7 +228,7 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo
}
}
- if ! isNewFile {
+ if !isNewFile {
_, err := ctx.Repo.Commit.GetTreeEntryByPath(oldTreeName)
if err != nil && git.IsErrNotExist(err) {
ctx.Data["Err_Filename"] = true
@@ -246,7 +246,7 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo
}
message := ctx.Tr("repo.user_has_committed_since_you_started_editing", name) +
` ` + ctx.Tr("repo.see_what_changed") + `` +
- " " + ctx.Tr("repo.pressing_commit_again_will_overwrite_those_changes", "" + ctx.Tr("repo.commit_changes") + "")
+ " " + ctx.Tr("repo.pressing_commit_again_will_overwrite_those_changes", ""+ctx.Tr("repo.commit_changes")+"")
log.Error(4, "%s: %s / %s - %s", "EditFile", branchName, oldTreeName, "File updated by another user")
ctx.RenderWithErr(message, EDIT, &form)
return
@@ -267,7 +267,7 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo
}
message := ""
- if form.CommitSummary!="" {
+ if form.CommitSummary != "" {
message = strings.Trim(form.CommitSummary, " ")
} else {
if isNewFile {
@@ -276,7 +276,7 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo
message = ctx.Tr("repo.update") + " '" + treeName + "'"
}
}
- if strings.Trim(form.CommitMessage, " ")!="" {
+ if strings.Trim(form.CommitMessage, " ") != "" {
message += "\n\n" + strings.Trim(form.CommitMessage, " ")
}
@@ -343,7 +343,7 @@ func DiffPreviewPost(ctx *context.Context, form auth.EditPreviewDiffForm) {
return
}
- if(diff.NumFiles() == 0){
+ if diff.NumFiles() == 0 {
ctx.Error(200, ctx.Tr("repo.no_changes_to_show"))
return
}
@@ -355,5 +355,5 @@ func DiffPreviewPost(ctx *context.Context, form auth.EditPreviewDiffForm) {
}
func EscapeUrl(str string) string {
- return strings.NewReplacer("?","%3F","%","%25","#","%23"," ","%20","^","%5E","\\","%5C","{","%7B","}","%7D","|","%7C").Replace(str)
+ return strings.NewReplacer("?", "%3F", "%", "%25", "#", "%23", " ", "%20", "^", "%5E", "\\", "%5C", "{", "%7B", "}", "%7D", "|", "%7C").Replace(str)
}
diff --git a/routers/repo/upload.go b/routers/repo/upload.go
index 647913d35..286094ae6 100644
--- a/routers/repo/upload.go
+++ b/routers/repo/upload.go
@@ -7,15 +7,15 @@ package repo
import (
"strings"
+ "fmt"
+ "github.com/gogits/gogs/models"
+ "github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/context"
"github.com/gogits/gogs/modules/log"
- "github.com/gogits/gogs/modules/auth"
- "path"
"github.com/gogits/gogs/modules/setting"
- "fmt"
"net/http"
- "github.com/gogits/gogs/models"
+ "path"
)
const (
@@ -104,7 +104,7 @@ func UploadFilePost(ctx *context.Context, form auth.UploadRepoFileForm) {
return
}
- if( oldBranchName != branchName ){
+ if oldBranchName != branchName {
if _, err := ctx.Repo.Repository.GetBranch(branchName); err == nil {
ctx.Data["Err_Branchname"] = true
ctx.RenderWithErr(ctx.Tr("repo.branch_already_exists"), UPLOAD, &form)
@@ -122,7 +122,7 @@ func UploadFilePost(ctx *context.Context, form auth.UploadRepoFileForm) {
// Means there is no item with that name, so we're good
break
}
- if ! entry.IsDir() {
+ if !entry.IsDir() {
ctx.Data["Err_Filename"] = true
ctx.RenderWithErr(ctx.Tr("repo.directory_is_a_file"), UPLOAD, &form)
log.Error(4, "%s: %s - %s", "UploadFile", treeName, "Directory given is a file")
@@ -131,16 +131,16 @@ func UploadFilePost(ctx *context.Context, form auth.UploadRepoFileForm) {
}
message := ""
- if form.CommitSummary!="" {
+ if form.CommitSummary != "" {
message = strings.Trim(form.CommitSummary, " ")
} else {
- message = ctx.Tr("repo.add_files_to_dir", "'" + treeName + "'")
+ message = ctx.Tr("repo.add_files_to_dir", "'"+treeName+"'")
}
- if strings.Trim(form.CommitMessage, " ")!="" {
+ if strings.Trim(form.CommitMessage, " ") != "" {
message += "\n\n" + strings.Trim(form.CommitMessage, " ")
}
- if err := ctx.Repo.Repository.UploadRepoFiles(ctx.User, oldBranchName, branchName, treeName, message, files); err != nil {
+ if err := ctx.Repo.Repository.UploadRepoFiles(ctx.User, oldBranchName, branchName, treeName, message, files); err != nil {
ctx.Data["Err_Directory"] = true
ctx.RenderWithErr(ctx.Tr("repo.unable_to_upload_files"), UPLOAD, &form)
log.Error(4, "%s: %v", "UploadFile", err)
@@ -179,7 +179,7 @@ func UploadFilePost(ctx *context.Context, form auth.UploadRepoFileForm) {
//if oldBranchName != branchName {
// ctx.Redirect(EscapeUrl(ctx.Repo.RepoLink + "/compare/" + oldBranchName + "..." + branchName))
//} else {
- ctx.Redirect(EscapeUrl(ctx.Repo.RepoLink + "/src/" + branchName + "/" + treeName))
+ ctx.Redirect(EscapeUrl(ctx.Repo.RepoLink + "/src/" + branchName + "/" + treeName))
//}
}
@@ -232,7 +232,7 @@ func UploadFileToServer(ctx *context.Context) {
})
}
-func UploadRemoveFileFromServer(ctx *context.Context, form auth.UploadRemoveFileForm) {
+func RemoveUploadFileFromServer(ctx *context.Context, form auth.RemoveUploadFileForm) {
if !setting.UploadEnabled {
ctx.Error(404, "upload is not enabled")
return
@@ -254,4 +254,4 @@ func UploadRemoveFileFromServer(ctx *context.Context, form auth.UploadRemoveFile
ctx.JSON(200, map[string]string{
"uuid": uuid,
})
-}
\ No newline at end of file
+}
diff --git a/routers/repo/view.go b/routers/repo/view.go
index 7e7712939..3f0a70aac 100644
--- a/routers/repo/view.go
+++ b/routers/repo/view.go
@@ -49,10 +49,10 @@ func Home(ctx *context.Context) {
branchLink := ctx.Repo.RepoLink + "/src/" + branchName
treeLink := branchLink
rawLink := ctx.Repo.RepoLink + "/raw/" + branchName
- editLink := ctx.Repo.RepoLink + "/edit/" + branchName
+ editLink := ctx.Repo.RepoLink + "/_edit/" + branchName
+ newFileLink := ctx.Repo.RepoLink + "/_new/" + branchName
deleteLink := ctx.Repo.RepoLink + "/delete/" + branchName
forkLink := setting.AppSubUrl + "/repo/fork/" + strconv.FormatInt(ctx.Repo.Repository.ID, 10)
- newFileLink := ctx.Repo.RepoLink + "/new/" + branchName
uploadFileLink := ctx.Repo.RepoLink + "/upload/" + branchName
// Get tree path
@@ -137,13 +137,13 @@ func Home(ctx *context.Context) {
}
}
}
- if ctx.Repo.IsWriter() && ctx.Repo.IsViewBranch {
+ if ctx.Repo.IsWriter() && ctx.Repo.IsViewBranch {
ctx.Data["FileEditLink"] = editLink + "/" + treename
ctx.Data["FileEditLinkTooltip"] = ctx.Tr("repo.edit_this_file")
} else {
- if ! ctx.Repo.IsViewBranch {
+ if !ctx.Repo.IsViewBranch {
ctx.Data["FileEditLinkTooltip"] = ctx.Tr("repo.must_be_on_branch")
- } else if ! ctx.Repo.IsWriter() {
+ } else if !ctx.Repo.IsWriter() {
ctx.Data["FileEditLink"] = forkLink
ctx.Data["FileEditLinkTooltip"] = ctx.Tr("repo.fork_before_edit")
}
@@ -155,9 +155,9 @@ func Home(ctx *context.Context) {
ctx.Data["FileDeleteLink"] = deleteLink + "/" + treename
ctx.Data["FileDeleteLinkTooltip"] = ctx.Tr("repo.delete_this_file")
} else {
- if ! ctx.Repo.IsViewBranch {
+ if !ctx.Repo.IsViewBranch {
ctx.Data["FileDeleteLinkTooltip"] = ctx.Tr("repo.must_be_on_branch")
- } else if ! ctx.Repo.IsWriter() {
+ } else if !ctx.Repo.IsWriter() {
ctx.Data["FileDeleteLinkTooltip"] = ctx.Tr("repo.must_be_writer")
}
}