mirror of
https://github.com/gogs/gogs.git
synced 2025-05-05 23:21:01 +00:00
Fixes per Unknwon's requests
This commit is contained in:
parent
6aa7e46b21
commit
c2895dc742
@ -494,17 +494,17 @@ func runWeb(ctx *cli.Context) error {
|
|||||||
Post(bindIgnErr(auth.CreateIssueForm{}), repo.CompareAndPullRequestPost)
|
Post(bindIgnErr(auth.CreateIssueForm{}), repo.CompareAndPullRequestPost)
|
||||||
|
|
||||||
m.Group("", func() {
|
m.Group("", func() {
|
||||||
m.Combo("/edit/*").Get(repo.EditFile).
|
m.Combo("/_edit/*").Get(repo.EditFile).
|
||||||
Post(bindIgnErr(auth.EditRepoFileForm{}), repo.EditFilePost)
|
Post(bindIgnErr(auth.EditRepoFileForm{}), repo.EditFilePost)
|
||||||
m.Combo("/new/*").Get(repo.EditNewFile).
|
m.Combo("/_new/*").Get(repo.NewFile).
|
||||||
Post(bindIgnErr(auth.EditRepoFileForm{}), repo.EditNewFilePost)
|
Post(bindIgnErr(auth.EditRepoFileForm{}), repo.NewFilePost)
|
||||||
m.Post("/preview/*", bindIgnErr(auth.EditPreviewDiffForm{}), repo.DiffPreviewPost)
|
m.Post("/preview/*", bindIgnErr(auth.EditPreviewDiffForm{}), repo.DiffPreviewPost)
|
||||||
m.Combo("/upload/*").Get(repo.UploadFile).
|
m.Combo("/upload/*").Get(repo.UploadFile).
|
||||||
Post(bindIgnErr(auth.UploadRepoFileForm{}), repo.UploadFilePost)
|
Post(bindIgnErr(auth.UploadRepoFileForm{}), repo.UploadFilePost)
|
||||||
m.Post("/delete/*", bindIgnErr(auth.DeleteRepoFileForm{}), repo.DeleteFilePost)
|
m.Post("/delete/*", bindIgnErr(auth.DeleteRepoFileForm{}), repo.DeleteFilePost)
|
||||||
m.Post("/branches", bindIgnErr(auth.NewBranchForm{}), repo.NewBranchPost)
|
m.Post("/branches", bindIgnErr(auth.NewBranchForm{}), repo.NewBranchPost)
|
||||||
m.Post("/upload-file", repo.UploadFileToServer)
|
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)
|
}, context.RepoRef(), context.RepoAssignment(), reqRepoWriter)
|
||||||
}, reqSignIn, context.RepoAssignment(), repo.MustBeNotBare)
|
}, reqSignIn, context.RepoAssignment(), repo.MustBeNotBare)
|
||||||
|
|
||||||
|
12
conf/app.ini
12
conf/app.ini
@ -23,22 +23,22 @@ PULL_REQUEST_QUEUE_LENGTH = 10000
|
|||||||
[editor]
|
[editor]
|
||||||
; List of file extensions that should have line wraps in the CodeMirror 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
|
; 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
|
; 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
|
; Separate values by commas. Preview tab in edit mode won't show if the file extension doesn't match
|
||||||
PREVIEW_TAB_APIS = markdown
|
PREVIEW_TAB_APIS = markdown
|
||||||
|
|
||||||
[upload]
|
[upload]
|
||||||
; Whether uploads are enabled. Defaults to `true`
|
; Whether repository file uploads are enabled. Defaults to `true`
|
||||||
ENABLE_UPLOADS = true
|
ENABLE_UPLOADS = true
|
||||||
; Path for uploads. Defaults to `data/tmp/uploads` (tmp gets deleted on gogs restart)
|
; 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
|
; 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
|
; 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
|
; Max number of files per upload. Defaults to 10
|
||||||
UPLOAD_MAX_FILES = 10
|
MAX_FILES = 10
|
||||||
|
|
||||||
[ui]
|
[ui]
|
||||||
; Number of repositories that are showed in one explore page
|
; Number of repositories that are showed in one explore page
|
||||||
|
@ -428,7 +428,7 @@ new_file = New file
|
|||||||
upload_files = Upload files
|
upload_files = Upload files
|
||||||
find_file = Find file
|
find_file = Find file
|
||||||
commit_changes = Commit Changes
|
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
|
last_commit_info = %s edited this file %s
|
||||||
delete_this_file = Delete this file
|
delete_this_file = Delete this file
|
||||||
edit_this_file = Edit this file
|
edit_this_file = Edit this file
|
||||||
@ -457,8 +457,8 @@ from = from
|
|||||||
upload_file = Upload file
|
upload_file = Upload file
|
||||||
add_files_to_dir = Add files to %s
|
add_files_to_dir = Add files to %s
|
||||||
unable_to_upload_files = Unable to upload files, an error occurred.
|
unable_to_upload_files = Unable to upload files, an error occurred.
|
||||||
add_subdir = Add subdirectory…
|
add_subdir = Add subdirectory...
|
||||||
name_your_file = Name your file…
|
name_your_file = Name your file...
|
||||||
user_has_committed_since_you_started_editing = %s has committed since you started editing.
|
user_has_committed_since_you_started_editing = %s has committed since you started editing.
|
||||||
see_what_changed = See what changed.
|
see_what_changed = See what changed.
|
||||||
pressing_commit_again_will_overwrite_those_changes = Pressing '%s' again will overwrite those changes.
|
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.new.no_assignee = No assignee
|
||||||
issues.create = Create Issue
|
issues.create = Create Issue
|
||||||
issues.new_label = New Label
|
issues.new_label = New Label
|
||||||
issues.new_label_placeholder = Label name…
|
issues.new_label_placeholder = Label name...
|
||||||
issues.create_label = Create Label
|
issues.create_label = Create Label
|
||||||
issues.open_tab = %d Open
|
issues.open_tab = %d Open
|
||||||
issues.close_tab = %d Closed
|
issues.close_tab = %d Closed
|
||||||
@ -676,7 +676,7 @@ settings.delete_collaborator = Delete
|
|||||||
settings.collaborator_deletion = Collaborator Deletion
|
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.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.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.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.user_is_org_member = User is organization member who cannot be added as a collaborator.
|
||||||
settings.add_webhook = Add Webhook
|
settings.add_webhook = Add Webhook
|
||||||
@ -768,7 +768,7 @@ release.title = Title
|
|||||||
release.content = Content
|
release.content = Content
|
||||||
release.write = Write
|
release.write = Write
|
||||||
release.preview = Preview
|
release.preview = Preview
|
||||||
release.loading = Loading…
|
release.loading = Loading...
|
||||||
release.prerelease_desc = This is a pre-release
|
release.prerelease_desc = This is a pre-release
|
||||||
release.prerelease_helper = We'll point out that this release is not production-ready.
|
release.prerelease_helper = We'll point out that this release is not production-ready.
|
||||||
release.cancel = Cancel
|
release.cancel = Cancel
|
||||||
@ -857,7 +857,7 @@ teams.read_permission_desc = This team grants <strong>Read</strong> access: memb
|
|||||||
teams.write_permission_desc = This team grants <strong>Write</strong> access: members can read from and push to the team's repositories.
|
teams.write_permission_desc = This team grants <strong>Write</strong> access: members can read from and push to the team's repositories.
|
||||||
teams.admin_permission_desc = This team grants <strong>Admin</strong> access: members can read from, push to, and add collaborators to the team's repositories.
|
teams.admin_permission_desc = This team grants <strong>Admin</strong> access: members can read from, push to, and add collaborators to the team's repositories.
|
||||||
teams.repositories = Team 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.add_team_repository = Add Team Repository
|
||||||
teams.remove_repo = Remove
|
teams.remove_repo = Remove
|
||||||
teams.add_nonexistent_repo = The repository you're trying to add does not exist, please create it first.
|
teams.add_nonexistent_repo = The repository you're trying to add does not exist, please create it first.
|
||||||
|
@ -427,7 +427,7 @@ func IsErrRepoFileAlreadyExist(err error) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (err ErrRepoFileAlreadyExist) Error() string {
|
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
// __________ .__
|
// __________ .__
|
||||||
|
@ -425,7 +425,6 @@ func NewIssue(repo *Repository, issue *Issue, labelIDs []int64, uuids []string)
|
|||||||
act := &Action{
|
act := &Action{
|
||||||
ActUserID: issue.Poster.ID,
|
ActUserID: issue.Poster.ID,
|
||||||
ActUserName: issue.Poster.Name,
|
ActUserName: issue.Poster.Name,
|
||||||
|
|
||||||
ActEmail: issue.Poster.Email,
|
ActEmail: issue.Poster.Email,
|
||||||
OpType: ACTION_CREATE_ISSUE,
|
OpType: ACTION_CREATE_ISSUE,
|
||||||
Content: fmt.Sprintf("%d|%s", issue.Index, issue.Name),
|
Content: fmt.Sprintf("%d|%s", issue.Index, issue.Name),
|
||||||
|
@ -9,7 +9,9 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"mime/multipart"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
@ -35,8 +37,6 @@ import (
|
|||||||
"github.com/gogits/gogs/modules/markdown"
|
"github.com/gogits/gogs/modules/markdown"
|
||||||
"github.com/gogits/gogs/modules/process"
|
"github.com/gogits/gogs/modules/process"
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
"mime/multipart"
|
|
||||||
"io"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -2223,8 +2223,8 @@ func (repo *Repository) CheckoutNewBranch(oldBranchName, newBranchName string) e
|
|||||||
|
|
||||||
func checkoutNewBranch(repoPath, localPath, oldBranch, newBranch string) error {
|
func checkoutNewBranch(repoPath, localPath, oldBranch, newBranch string) error {
|
||||||
if !com.IsExist(localPath) {
|
if !com.IsExist(localPath) {
|
||||||
if error := updateLocalCopy(repoPath, localPath, oldBranch); error != nil {
|
if err := updateLocalCopy(repoPath, localPath, oldBranch); error != nil {
|
||||||
return error
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := git.Checkout(localPath, git.CheckoutOptions{
|
if err := git.Checkout(localPath, git.CheckoutOptions{
|
||||||
@ -2248,7 +2248,7 @@ func (repo *Repository) UpdateRepoFile(doer *User, oldBranchName, branchName, ol
|
|||||||
return fmt.Errorf("UpdateLocalRepo: %s - %v", oldBranchName, err)
|
return fmt.Errorf("UpdateLocalRepo: %s - %v", oldBranchName, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if( oldBranchName != branchName ){
|
if oldBranchName != branchName {
|
||||||
if err := repo.CheckoutNewBranch(oldBranchName, branchName); err != nil {
|
if err := repo.CheckoutNewBranch(oldBranchName, branchName); err != nil {
|
||||||
return fmt.Errorf("CheckoutNewBranch: %s - %s: %v", oldBranchName, branchName, err)
|
return fmt.Errorf("CheckoutNewBranch: %s - %s: %v", oldBranchName, branchName, err)
|
||||||
}
|
}
|
||||||
@ -2265,9 +2265,7 @@ 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 new file, make sure it doesn't exist; if old file, move if file name change
|
||||||
if isNewFile {
|
if isNewFile {
|
||||||
@ -2308,9 +2306,7 @@ func (repo *Repository) GetPreviewDiff(repoPath, branchName, treeName, text stri
|
|||||||
localPath := repo.LocalRepoPath()
|
localPath := repo.LocalRepoPath()
|
||||||
filePath := path.Join(localPath, treeName)
|
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 {
|
if err = ioutil.WriteFile(filePath, []byte(text), 0666); err != nil {
|
||||||
return nil, fmt.Errorf("WriteFile: %v", err)
|
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)
|
return fmt.Errorf("UpdateLocalRepo: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if( oldBranchName != branchName ){
|
if oldBranchName != branchName {
|
||||||
repo.CheckoutNewBranch(oldBranchName, branchName)
|
repo.CheckoutNewBranch(oldBranchName, branchName)
|
||||||
}
|
}
|
||||||
|
|
||||||
dirPath := path.Join(localPath, treeName)
|
dirPath := path.Join(localPath, treeName)
|
||||||
|
|
||||||
if ! com.IsExist(dirPath) {
|
|
||||||
os.MkdirAll(dirPath, os.ModePerm)
|
os.MkdirAll(dirPath, os.ModePerm)
|
||||||
}
|
|
||||||
|
|
||||||
// Copy uploaded files into repository.
|
// Copy uploaded files into repository.
|
||||||
for _, uuid := range uuids {
|
for _, uuid := range uuids {
|
||||||
upload, err := getUpload(uuid, doer.Id, repo.ID)
|
upload, err := getUpload(uuid, doer.ID, repo.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if IsErrUploadNotExist(err) {
|
if IsErrUploadNotExist(err) {
|
||||||
continue
|
continue
|
||||||
@ -2425,10 +2419,10 @@ func (repo *Repository) UploadRepoFiles(doer *User, oldBranchName, branchName, t
|
|||||||
uuidPath := upload.LocalPath()
|
uuidPath := upload.LocalPath()
|
||||||
filePath := dirPath + "/" + upload.Name
|
filePath := dirPath + "/" + upload.Name
|
||||||
if err := os.Rename(uuidPath, filePath); err != nil {
|
if err := os.Rename(uuidPath, filePath); err != nil {
|
||||||
DeleteUpload(upload, true);
|
DeleteUpload(upload, true)
|
||||||
return fmt.Errorf("Rename[%s -> %s]: %v", uuidPath, filePath, err)
|
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 {
|
if len(message) == 0 {
|
||||||
@ -2534,13 +2528,13 @@ func RemoveUpload(uuid string, userId, repoId int64) (err error) {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getUpload(uuid string, userId, repoId int64) (*Upload, error) {
|
func getUpload(uuid string, userID, repoID int64) (*Upload, error) {
|
||||||
up := &Upload{UUID: uuid, UID: userId, RepoID: repoId}
|
up := &Upload{UUID: uuid, UID: userID, RepoID: repoID}
|
||||||
has, err := x.Get(up)
|
has, err := x.Get(up)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if !has {
|
} else if !has {
|
||||||
return nil, ErrUploadNotExist{0, uuid, userId, repoId}
|
return nil, ErrUploadNotExist{0, uuid, userID, repoID}
|
||||||
}
|
}
|
||||||
return up, nil
|
return up, nil
|
||||||
}
|
}
|
||||||
|
@ -45,4 +45,3 @@ func (p *workingPool) CheckOut(name string) {
|
|||||||
p.count[name]--
|
p.count[name]--
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ func (f *UploadRepoFileForm) Validate(ctx *macaron.Context, errs binding.Errors)
|
|||||||
return validate(errs, ctx.Data, f, ctx.Locale)
|
return validate(errs, ctx.Data, f, ctx.Locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
type UploadRemoveFileForm struct {
|
type RemoveUploadFileForm struct {
|
||||||
File string `binding:"Required;MaxSize(50)"`
|
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)
|
return validate(errs, ctx.Data, f, ctx.Locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// __________ .__
|
// __________ .__
|
||||||
// \______ \____________ ____ ____ | |__
|
// \______ \____________ ____ ____ | |__
|
||||||
// | | _/\_ __ \__ \ / \_/ ___\| | \
|
// | | _/\_ __ \__ \ / \_/ ___\| | \
|
||||||
|
@ -5,13 +5,13 @@
|
|||||||
package repo
|
package repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/gogits/gogs/models"
|
||||||
|
"github.com/gogits/gogs/modules/auth"
|
||||||
"github.com/gogits/gogs/modules/base"
|
"github.com/gogits/gogs/modules/base"
|
||||||
"github.com/gogits/gogs/modules/context"
|
"github.com/gogits/gogs/modules/context"
|
||||||
"github.com/gogits/gogs/modules/auth"
|
|
||||||
"github.com/gogits/gogs/modules/log"
|
"github.com/gogits/gogs/modules/log"
|
||||||
"strings"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
"github.com/gogits/gogs/models"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
package repo
|
package repo
|
||||||
|
|
||||||
import (
|
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/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) {
|
func DeleteFilePost(ctx *context.Context, form auth.DeleteRepoFileForm) {
|
||||||
|
@ -6,17 +6,17 @@ package repo
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"strings"
|
|
||||||
"path"
|
"path"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/gogits/git-module"
|
"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/base"
|
||||||
"github.com/gogits/gogs/modules/context"
|
"github.com/gogits/gogs/modules/context"
|
||||||
"github.com/gogits/gogs/modules/log"
|
"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/setting"
|
||||||
|
"github.com/gogits/gogs/modules/template"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -29,7 +29,7 @@ func EditFile(ctx *context.Context) {
|
|||||||
editFile(ctx, false)
|
editFile(ctx, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func EditNewFile(ctx *context.Context) {
|
func NewFile(ctx *context.Context) {
|
||||||
editFile(ctx, true)
|
editFile(ctx, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,11 +124,11 @@ func editFile(ctx *context.Context, isNewFile bool) {
|
|||||||
ctx.HTML(200, EDIT)
|
ctx.HTML(200, EDIT)
|
||||||
}
|
}
|
||||||
|
|
||||||
func EditFilePost(ctx *context.Context, form auth.EditRepoFileForm) {
|
func FilePost(ctx *context.Context, form auth.EditRepoFileForm) {
|
||||||
editFilePost(ctx, form, false)
|
editFilePost(ctx, form, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func EditNewFilePost(ctx *context.Context, form auth.EditRepoFileForm) {
|
func NewFilePost(ctx *context.Context, form auth.EditRepoFileForm) {
|
||||||
editFilePost(ctx, form, true)
|
editFilePost(ctx, form, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if( oldBranchName != branchName ){
|
if oldBranchName != branchName {
|
||||||
if _, err := ctx.Repo.Repository.GetBranch(branchName); err == nil {
|
if _, err := ctx.Repo.Repository.GetBranch(branchName); err == nil {
|
||||||
ctx.Data["Err_Branchname"] = true
|
ctx.Data["Err_Branchname"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("repo.branch_already_exists"), EDIT, &form)
|
ctx.RenderWithErr(ctx.Tr("repo.branch_already_exists"), EDIT, &form)
|
||||||
@ -343,7 +343,7 @@ func DiffPreviewPost(ctx *context.Context, form auth.EditPreviewDiffForm) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if(diff.NumFiles() == 0){
|
if diff.NumFiles() == 0 {
|
||||||
ctx.Error(200, ctx.Tr("repo.no_changes_to_show"))
|
ctx.Error(200, ctx.Tr("repo.no_changes_to_show"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -7,15 +7,15 @@ package repo
|
|||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"fmt"
|
||||||
|
"github.com/gogits/gogs/models"
|
||||||
|
"github.com/gogits/gogs/modules/auth"
|
||||||
"github.com/gogits/gogs/modules/base"
|
"github.com/gogits/gogs/modules/base"
|
||||||
"github.com/gogits/gogs/modules/context"
|
"github.com/gogits/gogs/modules/context"
|
||||||
"github.com/gogits/gogs/modules/log"
|
"github.com/gogits/gogs/modules/log"
|
||||||
"github.com/gogits/gogs/modules/auth"
|
|
||||||
"path"
|
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
"fmt"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"github.com/gogits/gogs/models"
|
"path"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -104,7 +104,7 @@ func UploadFilePost(ctx *context.Context, form auth.UploadRepoFileForm) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if( oldBranchName != branchName ){
|
if oldBranchName != branchName {
|
||||||
if _, err := ctx.Repo.Repository.GetBranch(branchName); err == nil {
|
if _, err := ctx.Repo.Repository.GetBranch(branchName); err == nil {
|
||||||
ctx.Data["Err_Branchname"] = true
|
ctx.Data["Err_Branchname"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("repo.branch_already_exists"), UPLOAD, &form)
|
ctx.RenderWithErr(ctx.Tr("repo.branch_already_exists"), UPLOAD, &form)
|
||||||
@ -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 {
|
if !setting.UploadEnabled {
|
||||||
ctx.Error(404, "upload is not enabled")
|
ctx.Error(404, "upload is not enabled")
|
||||||
return
|
return
|
||||||
|
@ -49,10 +49,10 @@ func Home(ctx *context.Context) {
|
|||||||
branchLink := ctx.Repo.RepoLink + "/src/" + branchName
|
branchLink := ctx.Repo.RepoLink + "/src/" + branchName
|
||||||
treeLink := branchLink
|
treeLink := branchLink
|
||||||
rawLink := ctx.Repo.RepoLink + "/raw/" + branchName
|
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
|
deleteLink := ctx.Repo.RepoLink + "/delete/" + branchName
|
||||||
forkLink := setting.AppSubUrl + "/repo/fork/" + strconv.FormatInt(ctx.Repo.Repository.ID, 10)
|
forkLink := setting.AppSubUrl + "/repo/fork/" + strconv.FormatInt(ctx.Repo.Repository.ID, 10)
|
||||||
newFileLink := ctx.Repo.RepoLink + "/new/" + branchName
|
|
||||||
uploadFileLink := ctx.Repo.RepoLink + "/upload/" + branchName
|
uploadFileLink := ctx.Repo.RepoLink + "/upload/" + branchName
|
||||||
|
|
||||||
// Get tree path
|
// Get tree path
|
||||||
|
Loading…
x
Reference in New Issue
Block a user