| @@ -3,7 +3,7 @@ Gogs - Go Git Service [ |  | ||||
| ##### Current tip version: 0.9.84 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions) | |||||
| ##### Current tip version: 0.9.85 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions) | |||||
| | Web | UI | Preview | | | Web | UI | Preview | | ||||
| |:-------------:|:-------:|:-------:| | |:-------------:|:-------:|:-------:| | ||||
| @@ -447,6 +447,7 @@ cannot_edit_binary_files = Cannot edit binary files | |||||
| filename_help = To add directory, just type it and press /. To remove a directory, go to the beginning of the field and press backspace. | filename_help = To add directory, just type it and press /. To remove a directory, go to the beginning of the field and press backspace. | ||||
| fork_before_edit = You must fork this before editing | fork_before_edit = You must fork this before editing | ||||
| new_branch = new branch | new_branch = new branch | ||||
| editor.file_delete_success = File '%s' has been deleted successfully! | |||||
| editor.commit_directly_to_this_branch = Commit directly to the <strong class="branch-name">%s</strong> branch. | editor.commit_directly_to_this_branch = Commit directly to the <strong class="branch-name">%s</strong> branch. | ||||
| editor.create_new_branch = Create a <strong>new branch</strong> for this commit and start a pull request. | editor.create_new_branch = Create a <strong>new branch</strong> for this commit and start a pull request. | ||||
| editor.filename_cannot_be_empty = Filename cannot be empty. | editor.filename_cannot_be_empty = Filename cannot be empty. | ||||
| @@ -17,7 +17,7 @@ import ( | |||||
| "github.com/gogits/gogs/modules/setting" | "github.com/gogits/gogs/modules/setting" | ||||
| ) | ) | ||||
| const APP_VER = "0.9.84.0824" | |||||
| const APP_VER = "0.9.85.0824" | |||||
| func init() { | func init() { | ||||
| runtime.GOMAXPROCS(runtime.NumCPU()) | runtime.GOMAXPROCS(runtime.NumCPU()) | ||||
| @@ -2260,7 +2260,7 @@ func (repo *Repository) GetForks() ([]*Repository, error) { | |||||
| // | // | ||||
| // uploadRepoFiles uploads new files to repository. | // uploadRepoFiles uploads new files to repository. | ||||
| func (repo *Repository) UploadRepoFiles(doer *User, oldBranchName, branchName, treeName, message string, uuids []string) (err error) { | |||||
| func (repo *Repository) UploadRepoFiles(doer *User, oldBranchName, branchName, treePath, message string, uuids []string) (err error) { | |||||
| repoWorkingPool.CheckIn(com.ToStr(repo.ID)) | repoWorkingPool.CheckIn(com.ToStr(repo.ID)) | ||||
| defer repoWorkingPool.CheckOut(com.ToStr(repo.ID)) | defer repoWorkingPool.CheckOut(com.ToStr(repo.ID)) | ||||
| @@ -2276,7 +2276,7 @@ func (repo *Repository) UploadRepoFiles(doer *User, oldBranchName, branchName, t | |||||
| repo.CheckoutNewBranch(oldBranchName, branchName) | repo.CheckoutNewBranch(oldBranchName, branchName) | ||||
| } | } | ||||
| dirPath := path.Join(localPath, treeName) | |||||
| dirPath := path.Join(localPath, treePath) | |||||
| os.MkdirAll(dirPath, os.ModePerm) | os.MkdirAll(dirPath, os.ModePerm) | ||||
| // Copy uploaded files into repository. | // Copy uploaded files into repository. | ||||
| @@ -2298,7 +2298,7 @@ func (repo *Repository) UploadRepoFiles(doer *User, oldBranchName, branchName, t | |||||
| } | } | ||||
| if len(message) == 0 { | if len(message) == 0 { | ||||
| message = "Add files to '" + treeName + "'" | |||||
| message = "Add files to '" + treePath + "'" | |||||
| } | } | ||||
| if err = git.AddChanges(localPath, true); err != nil { | if err = git.AddChanges(localPath, true); err != nil { | ||||
| @@ -173,7 +173,7 @@ func (repo *Repository) UpdateRepoFile(doer *User, opts UpdateRepoFileOptions) ( | |||||
| } | } | ||||
| // GetDiffPreview produces and returns diff result of a file which is not yet committed. | // GetDiffPreview produces and returns diff result of a file which is not yet committed. | ||||
| func (repo *Repository) GetDiffPreview(branch, treeName, content string) (diff *Diff, err error) { | |||||
| func (repo *Repository) GetDiffPreview(branch, treePath, content string) (diff *Diff, err error) { | |||||
| repoWorkingPool.CheckIn(com.ToStr(repo.ID)) | repoWorkingPool.CheckIn(com.ToStr(repo.ID)) | ||||
| defer repoWorkingPool.CheckOut(com.ToStr(repo.ID)) | defer repoWorkingPool.CheckOut(com.ToStr(repo.ID)) | ||||
| @@ -184,13 +184,13 @@ func (repo *Repository) GetDiffPreview(branch, treeName, content string) (diff * | |||||
| } | } | ||||
| localPath := repo.LocalCopyPath() | localPath := repo.LocalCopyPath() | ||||
| filePath := path.Join(localPath, treeName) | |||||
| filePath := path.Join(localPath, treePath) | |||||
| os.MkdirAll(filepath.Dir(filePath), os.ModePerm) | os.MkdirAll(filepath.Dir(filePath), os.ModePerm) | ||||
| if err = ioutil.WriteFile(filePath, []byte(content), 0666); err != nil { | if err = ioutil.WriteFile(filePath, []byte(content), 0666); err != nil { | ||||
| return nil, fmt.Errorf("WriteFile: %v", err) | return nil, fmt.Errorf("WriteFile: %v", err) | ||||
| } | } | ||||
| cmd := exec.Command("git", "diff", treeName) | |||||
| cmd := exec.Command("git", "diff", treePath) | |||||
| cmd.Dir = localPath | cmd.Dir = localPath | ||||
| cmd.Stderr = os.Stderr | cmd.Stderr = os.Stderr | ||||
| @@ -278,7 +278,7 @@ func (f *NewWikiForm) Validate(ctx *macaron.Context, errs binding.Errors) bindin | |||||
| // \/ \/ | // \/ \/ | ||||
| type EditRepoFileForm struct { | type EditRepoFileForm struct { | ||||
| TreeName string `binding:"Required;MaxSize(500)"` | |||||
| TreePath string `binding:"Required;MaxSize(500)"` | |||||
| Content string `binding:"Required"` | Content string `binding:"Required"` | ||||
| CommitSummary string `binding:"MaxSize(100)` | CommitSummary string `binding:"MaxSize(100)` | ||||
| CommitMessage string | CommitMessage string | ||||
| @@ -41,14 +41,14 @@ type Repository struct { | |||||
| GitRepo *git.Repository | GitRepo *git.Repository | ||||
| BranchName string | BranchName string | ||||
| TagName string | TagName string | ||||
| TreeName string | |||||
| TreePath string | |||||
| CommitID string | CommitID string | ||||
| RepoLink string | RepoLink string | ||||
| CloneLink models.CloneLink | CloneLink models.CloneLink | ||||
| CommitsCount int64 | CommitsCount int64 | ||||
| Mirror *models.Mirror | Mirror *models.Mirror | ||||
| PullRequest *PullRequest | |||||
| PullRequest *PullRequest | |||||
| } | } | ||||
| // IsOwner returns true if current user is the owner of repository. | // IsOwner returns true if current user is the owner of repository. | ||||
| @@ -384,7 +384,7 @@ func RepoRef() macaron.Handler { | |||||
| if ctx.Repo.GitRepo.IsBranchExist(refName) || | if ctx.Repo.GitRepo.IsBranchExist(refName) || | ||||
| ctx.Repo.GitRepo.IsTagExist(refName) { | ctx.Repo.GitRepo.IsTagExist(refName) { | ||||
| if i < len(parts)-1 { | if i < len(parts)-1 { | ||||
| ctx.Repo.TreeName = strings.Join(parts[i+1:], "/") | |||||
| ctx.Repo.TreePath = strings.Join(parts[i+1:], "/") | |||||
| } | } | ||||
| hasMatched = true | hasMatched = true | ||||
| break | break | ||||
| @@ -392,7 +392,7 @@ func RepoRef() macaron.Handler { | |||||
| } | } | ||||
| if !hasMatched && len(parts[0]) == 40 { | if !hasMatched && len(parts[0]) == 40 { | ||||
| refName = parts[0] | refName = parts[0] | ||||
| ctx.Repo.TreeName = strings.Join(parts[1:], "/") | |||||
| ctx.Repo.TreePath = strings.Join(parts[1:], "/") | |||||
| } | } | ||||
| if ctx.Repo.GitRepo.IsBranchExist(refName) { | if ctx.Repo.GitRepo.IsBranchExist(refName) { | ||||
| @@ -779,7 +779,7 @@ function initEditor() { | |||||
| }); | }); | ||||
| if ($(this).val()) | if ($(this).val()) | ||||
| parts.push($(this).val()); | parts.push($(this).val()); | ||||
| $('#tree-name').val(parts.join('/')); | |||||
| $('#tree_path').val(parts.join('/')); | |||||
| }).trigger('keyup'); | }).trigger('keyup'); | ||||
| var $editArea = $('.repository.editor textarea#edit_area'); | var $editArea = $('.repository.editor textarea#edit_area'); | ||||
| @@ -19,7 +19,7 @@ func GetRawFile(ctx *context.APIContext) { | |||||
| return | return | ||||
| } | } | ||||
| blob, err := ctx.Repo.Commit.GetBlobByPath(ctx.Repo.TreeName) | |||||
| blob, err := ctx.Repo.Commit.GetBlobByPath(ctx.Repo.TreePath) | |||||
| if err != nil { | if err != nil { | ||||
| if git.IsErrNotExist(err) { | if git.IsErrNotExist(err) { | ||||
| ctx.Status(404) | ctx.Status(404) | ||||
| @@ -25,9 +25,9 @@ const ( | |||||
| func RefCommits(ctx *context.Context) { | func RefCommits(ctx *context.Context) { | ||||
| switch { | switch { | ||||
| case len(ctx.Repo.TreeName) == 0: | |||||
| case len(ctx.Repo.TreePath) == 0: | |||||
| Commits(ctx) | Commits(ctx) | ||||
| case ctx.Repo.TreeName == "search": | |||||
| case ctx.Repo.TreePath == "search": | |||||
| SearchCommits(ctx) | SearchCommits(ctx) | ||||
| default: | default: | ||||
| FileHistory(ctx) | FileHistory(ctx) | ||||
| @@ -104,7 +104,7 @@ func SearchCommits(ctx *context.Context) { | |||||
| func FileHistory(ctx *context.Context) { | func FileHistory(ctx *context.Context) { | ||||
| ctx.Data["IsRepoToolbarCommits"] = true | ctx.Data["IsRepoToolbarCommits"] = true | ||||
| fileName := ctx.Repo.TreeName | |||||
| fileName := ctx.Repo.TreePath | |||||
| if len(fileName) == 0 { | if len(fileName) == 0 { | ||||
| Commits(ctx) | Commits(ctx) | ||||
| return | return | ||||
| @@ -25,7 +25,7 @@ func ServeData(ctx *context.Context, name string, reader io.Reader) error { | |||||
| if !isTextFile { | if !isTextFile { | ||||
| _, isImageFile := base.IsImageFile(buf) | _, isImageFile := base.IsImageFile(buf) | ||||
| if !isImageFile { | if !isImageFile { | ||||
| ctx.Resp.Header().Set("Content-Disposition", "attachment; filename=\""+path.Base(ctx.Repo.TreeName)+"\"") | |||||
| ctx.Resp.Header().Set("Content-Disposition", "attachment; filename=\""+path.Base(ctx.Repo.TreePath)+"\"") | |||||
| ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary") | ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary") | ||||
| } | } | ||||
| } else if !ctx.QueryBool("render") { | } else if !ctx.QueryBool("render") { | ||||
| @@ -42,11 +42,11 @@ func ServeBlob(ctx *context.Context, blob *git.Blob) error { | |||||
| return err | return err | ||||
| } | } | ||||
| return ServeData(ctx, ctx.Repo.TreeName, dataRc) | |||||
| return ServeData(ctx, ctx.Repo.TreePath, dataRc) | |||||
| } | } | ||||
| func SingleDownload(ctx *context.Context) { | func SingleDownload(ctx *context.Context) { | ||||
| blob, err := ctx.Repo.Commit.GetBlobByPath(ctx.Repo.TreeName) | |||||
| blob, err := ctx.Repo.Commit.GetBlobByPath(ctx.Repo.TreePath) | |||||
| if err != nil { | if err != nil { | ||||
| if git.IsErrNotExist(err) { | if git.IsErrNotExist(err) { | ||||
| ctx.Handle(404, "GetBlobByPath", nil) | ctx.Handle(404, "GetBlobByPath", nil) | ||||
| @@ -32,15 +32,14 @@ func editFile(ctx *context.Context, isNewFile bool) { | |||||
| ctx.Data["RequireSimpleMDE"] = true | ctx.Data["RequireSimpleMDE"] = true | ||||
| branchLink := ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchName | branchLink := ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchName | ||||
| treeName := ctx.Repo.TreeName | |||||
| var treeNames []string | var treeNames []string | ||||
| if len(treeName) > 0 { | |||||
| treeNames = strings.Split(treeName, "/") | |||||
| if len(ctx.Repo.TreePath) > 0 { | |||||
| treeNames = strings.Split(ctx.Repo.TreePath, "/") | |||||
| } | } | ||||
| if !isNewFile { | if !isNewFile { | ||||
| entry, err := ctx.Repo.Commit.GetTreeEntryByPath(treeName) | |||||
| entry, err := ctx.Repo.Commit.GetTreeEntryByPath(ctx.Repo.TreePath) | |||||
| if err != nil { | if err != nil { | ||||
| if git.IsErrNotExist(err) { | if git.IsErrNotExist(err) { | ||||
| ctx.Handle(404, "GetTreeEntryByPath", err) | ctx.Handle(404, "GetTreeEntryByPath", err) | ||||
| @@ -83,7 +82,7 @@ func editFile(ctx *context.Context, isNewFile bool) { | |||||
| buf = append(buf, d...) | buf = append(buf, d...) | ||||
| if err, content := template.ToUTF8WithErr(buf); err != nil { | if err, content := template.ToUTF8WithErr(buf); err != nil { | ||||
| if err != nil { | if err != nil { | ||||
| log.Error(4, "Convert content encoding: %s", err) | |||||
| log.Error(4, "ToUTF8WithErr: %v", err) | |||||
| } | } | ||||
| ctx.Data["FileContent"] = string(buf) | ctx.Data["FileContent"] = string(buf) | ||||
| } else { | } else { | ||||
| @@ -93,7 +92,7 @@ func editFile(ctx *context.Context, isNewFile bool) { | |||||
| treeNames = append(treeNames, "") // Append empty string to allow user name the new file. | treeNames = append(treeNames, "") // Append empty string to allow user name the new file. | ||||
| } | } | ||||
| ctx.Data["TreeName"] = treeName | |||||
| ctx.Data["TreePath"] = ctx.Repo.TreePath | |||||
| ctx.Data["TreeNames"] = treeNames | ctx.Data["TreeNames"] = treeNames | ||||
| ctx.Data["BranchLink"] = branchLink | ctx.Data["BranchLink"] = branchLink | ||||
| ctx.Data["commit_summary"] = "" | ctx.Data["commit_summary"] = "" | ||||
| @@ -125,7 +124,7 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo | |||||
| oldBranchName := ctx.Repo.BranchName | oldBranchName := ctx.Repo.BranchName | ||||
| branchName := oldBranchName | branchName := oldBranchName | ||||
| branchLink := ctx.Repo.RepoLink + "/src/" + branchName | branchLink := ctx.Repo.RepoLink + "/src/" + branchName | ||||
| oldTreeName := ctx.Repo.TreeName | |||||
| oldTreePath := ctx.Repo.TreePath | |||||
| content := form.Content | content := form.Content | ||||
| commitChoice := form.CommitChoice | commitChoice := form.CommitChoice | ||||
| lastCommit := form.LastCommit | lastCommit := form.LastCommit | ||||
| @@ -135,16 +134,14 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo | |||||
| branchName = form.NewBranchName | branchName = form.NewBranchName | ||||
| } | } | ||||
| treeName := form.TreeName | |||||
| treeName = strings.Trim(treeName, " ") | |||||
| treeName = strings.Trim(treeName, "/") | |||||
| form.TreePath = strings.Trim(form.TreePath, " /") | |||||
| var treeNames []string | var treeNames []string | ||||
| if len(treeName) > 0 { | |||||
| treeNames = strings.Split(treeName, "/") | |||||
| if len(form.TreePath) > 0 { | |||||
| treeNames = strings.Split(form.TreePath, "/") | |||||
| } | } | ||||
| ctx.Data["TreeName"] = treeName | |||||
| ctx.Data["TreePath"] = form.TreePath | |||||
| ctx.Data["TreeNames"] = treeNames | ctx.Data["TreeNames"] = treeNames | ||||
| ctx.Data["BranchLink"] = branchLink | ctx.Data["BranchLink"] = branchLink | ||||
| ctx.Data["FileContent"] = content | ctx.Data["FileContent"] = content | ||||
| @@ -162,24 +159,24 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo | |||||
| return | return | ||||
| } | } | ||||
| if len(treeName) == 0 { | |||||
| ctx.Data["Err_Filename"] = true | |||||
| if len(form.TreePath) == 0 { | |||||
| ctx.Data["Err_TreePath"] = true | |||||
| ctx.RenderWithErr(ctx.Tr("repo.editor.filename_cannot_be_empty"), EDIT, &form) | ctx.RenderWithErr(ctx.Tr("repo.editor.filename_cannot_be_empty"), EDIT, &form) | ||||
| 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_NewBranchName"] = true | |||||
| ctx.RenderWithErr(ctx.Tr("repo.editor.branch_already_exists", branchName), EDIT, &form) | ctx.RenderWithErr(ctx.Tr("repo.editor.branch_already_exists", branchName), EDIT, &form) | ||||
| return | return | ||||
| } | } | ||||
| } | } | ||||
| var treepath string | |||||
| var newTreePath string | |||||
| for index, part := range treeNames { | for index, part := range treeNames { | ||||
| treepath = path.Join(treepath, part) | |||||
| entry, err := ctx.Repo.Commit.GetTreeEntryByPath(treepath) | |||||
| newTreePath = path.Join(newTreePath, part) | |||||
| entry, err := ctx.Repo.Commit.GetTreeEntryByPath(newTreePath) | |||||
| if err != nil { | if err != nil { | ||||
| if git.IsErrNotExist(err) { | if git.IsErrNotExist(err) { | ||||
| // Means there is no item with that name, so we're good | // Means there is no item with that name, so we're good | ||||
| @@ -191,13 +188,13 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo | |||||
| } | } | ||||
| if index != len(treeNames)-1 { | if index != len(treeNames)-1 { | ||||
| if !entry.IsDir() { | if !entry.IsDir() { | ||||
| ctx.Data["Err_Filename"] = true | |||||
| ctx.Data["Err_TreePath"] = true | |||||
| ctx.RenderWithErr(ctx.Tr("repo.editor.directory_is_a_file", part), EDIT, &form) | ctx.RenderWithErr(ctx.Tr("repo.editor.directory_is_a_file", part), EDIT, &form) | ||||
| return | return | ||||
| } | } | ||||
| } else { | } else { | ||||
| if entry.IsDir() { | if entry.IsDir() { | ||||
| ctx.Data["Err_Filename"] = true | |||||
| ctx.Data["Err_TreePath"] = true | |||||
| ctx.RenderWithErr(ctx.Tr("repo.editor.filename_is_a_directory", part), EDIT, &form) | ctx.RenderWithErr(ctx.Tr("repo.editor.filename_is_a_directory", part), EDIT, &form) | ||||
| return | return | ||||
| } | } | ||||
| @@ -205,11 +202,11 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo | |||||
| } | } | ||||
| if !isNewFile { | if !isNewFile { | ||||
| _, err := ctx.Repo.Commit.GetTreeEntryByPath(oldTreeName) | |||||
| _, err := ctx.Repo.Commit.GetTreeEntryByPath(oldTreePath) | |||||
| if err != nil { | if err != nil { | ||||
| if git.IsErrNotExist(err) { | if git.IsErrNotExist(err) { | ||||
| ctx.Data["Err_Filename"] = true | |||||
| ctx.RenderWithErr(ctx.Tr("repo.editor.file_editing_no_longer_exists", oldTreeName), EDIT, &form) | |||||
| ctx.Data["Err_TreePath"] = true | |||||
| ctx.RenderWithErr(ctx.Tr("repo.editor.file_editing_no_longer_exists", oldTreePath), EDIT, &form) | |||||
| } else { | } else { | ||||
| ctx.Handle(500, "GetTreeEntryByPath", err) | ctx.Handle(500, "GetTreeEntryByPath", err) | ||||
| } | } | ||||
| @@ -223,7 +220,7 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo | |||||
| } | } | ||||
| for _, file := range files { | for _, file := range files { | ||||
| if file == treeName { | |||||
| if file == form.TreePath { | |||||
| ctx.RenderWithErr(ctx.Tr("repo.editor.file_changed_while_editing", ctx.Repo.RepoLink+"/compare/"+lastCommit+"..."+ctx.Repo.CommitID), EDIT, &form) | ctx.RenderWithErr(ctx.Tr("repo.editor.file_changed_while_editing", ctx.Repo.RepoLink+"/compare/"+lastCommit+"..."+ctx.Repo.CommitID), EDIT, &form) | ||||
| return | return | ||||
| } | } | ||||
| @@ -231,9 +228,9 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo | |||||
| } | } | ||||
| } | } | ||||
| if oldTreeName != treeName { | |||||
| if oldTreePath != form.TreePath { | |||||
| // We have a new filename (rename or completely new file) so we need to make sure it doesn't already exist, can't clobber. | // We have a new filename (rename or completely new file) so we need to make sure it doesn't already exist, can't clobber. | ||||
| entry, err := ctx.Repo.Commit.GetTreeEntryByPath(treeName) | |||||
| entry, err := ctx.Repo.Commit.GetTreeEntryByPath(form.TreePath) | |||||
| if err != nil { | if err != nil { | ||||
| if !git.IsErrNotExist(err) { | if !git.IsErrNotExist(err) { | ||||
| ctx.Handle(500, "GetTreeEntryByPath", err) | ctx.Handle(500, "GetTreeEntryByPath", err) | ||||
| @@ -241,8 +238,8 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo | |||||
| } | } | ||||
| } | } | ||||
| if entry != nil { | if entry != nil { | ||||
| ctx.Data["Err_Filename"] = true | |||||
| ctx.RenderWithErr(ctx.Tr("repo.editor.file_already_exists", treeName), EDIT, &form) | |||||
| ctx.Data["Err_TreePath"] = true | |||||
| ctx.RenderWithErr(ctx.Tr("repo.editor.file_already_exists", form.TreePath), EDIT, &form) | |||||
| return | return | ||||
| } | } | ||||
| } | } | ||||
| @@ -252,9 +249,9 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo | |||||
| message = strings.TrimSpace(form.CommitSummary) | message = strings.TrimSpace(form.CommitSummary) | ||||
| } else { | } else { | ||||
| if isNewFile { | if isNewFile { | ||||
| message = ctx.Tr("repo.editor.add", treeName) | |||||
| message = ctx.Tr("repo.editor.add", form.TreePath) | |||||
| } else { | } else { | ||||
| message = ctx.Tr("repo.editor.update", treeName) | |||||
| message = ctx.Tr("repo.editor.update", form.TreePath) | |||||
| } | } | ||||
| } | } | ||||
| @@ -267,18 +264,18 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo | |||||
| LastCommitID: lastCommit, | LastCommitID: lastCommit, | ||||
| OldBranch: oldBranchName, | OldBranch: oldBranchName, | ||||
| NewBranch: branchName, | NewBranch: branchName, | ||||
| OldTreeName: oldTreeName, | |||||
| NewTreeName: treeName, | |||||
| OldTreeName: oldTreePath, | |||||
| NewTreeName: form.TreePath, | |||||
| Message: message, | Message: message, | ||||
| Content: content, | Content: content, | ||||
| IsNewFile: isNewFile, | IsNewFile: isNewFile, | ||||
| }); err != nil { | }); err != nil { | ||||
| ctx.Data["Err_Filename"] = true | |||||
| ctx.Data["Err_TreePath"] = true | |||||
| ctx.RenderWithErr(ctx.Tr("repo.editor.failed_to_update_file", err), EDIT, &form) | ctx.RenderWithErr(ctx.Tr("repo.editor.failed_to_update_file", err), EDIT, &form) | ||||
| return | return | ||||
| } | } | ||||
| ctx.Redirect(ctx.Repo.RepoLink + "/src/" + branchName + "/" + treeName) | |||||
| ctx.Redirect(ctx.Repo.RepoLink + "/src/" + branchName + "/" + form.TreePath) | |||||
| } | } | ||||
| func EditFilePost(ctx *context.Context, form auth.EditRepoFileForm) { | func EditFilePost(ctx *context.Context, form auth.EditRepoFileForm) { | ||||
| @@ -290,7 +287,7 @@ func NewFilePost(ctx *context.Context, form auth.EditRepoFileForm) { | |||||
| } | } | ||||
| func DiffPreviewPost(ctx *context.Context, form auth.EditPreviewDiffForm) { | func DiffPreviewPost(ctx *context.Context, form auth.EditPreviewDiffForm) { | ||||
| treeName := ctx.Repo.TreeName | |||||
| treeName := ctx.Repo.TreePath | |||||
| content := form.Content | content := form.Content | ||||
| entry, err := ctx.Repo.Commit.GetTreeEntryByPath(treeName) | entry, err := ctx.Repo.Commit.GetTreeEntryByPath(treeName) | ||||
| @@ -325,7 +322,7 @@ func DiffPreviewPost(ctx *context.Context, form auth.EditPreviewDiffForm) { | |||||
| func DeleteFilePost(ctx *context.Context, form auth.DeleteRepoFileForm) { | func DeleteFilePost(ctx *context.Context, form auth.DeleteRepoFileForm) { | ||||
| branchName := ctx.Repo.BranchName | branchName := ctx.Repo.BranchName | ||||
| treeName := ctx.Repo.TreeName | |||||
| treeName := ctx.Repo.TreePath | |||||
| if ctx.HasError() { | if ctx.HasError() { | ||||
| ctx.Redirect(ctx.Repo.RepoLink + "/src/" + branchName + "/" + treeName) | ctx.Redirect(ctx.Repo.RepoLink + "/src/" + branchName + "/" + treeName) | ||||
| @@ -342,5 +339,6 @@ func DeleteFilePost(ctx *context.Context, form auth.DeleteRepoFileForm) { | |||||
| return | return | ||||
| } | } | ||||
| ctx.Flash.Success(ctx.Tr("repo.editor.file_delete_success", treeName)) | |||||
| ctx.Redirect(ctx.Repo.RepoLink + "/src/" + branchName) | ctx.Redirect(ctx.Repo.RepoLink + "/src/" + branchName) | ||||
| } | } | ||||
| @@ -331,6 +331,8 @@ func setTemplateIfExists(ctx *context.Context, ctxDataKey string, possibleFiles | |||||
| func NewIssue(ctx *context.Context) { | func NewIssue(ctx *context.Context) { | ||||
| ctx.Data["Title"] = ctx.Tr("repo.issues.new") | ctx.Data["Title"] = ctx.Tr("repo.issues.new") | ||||
| ctx.Data["PageIsIssueList"] = true | ctx.Data["PageIsIssueList"] = true | ||||
| ctx.Data["RequireHighlightJS"] = true | |||||
| ctx.Data["RequireSimpleMDE"] = true | |||||
| setTemplateIfExists(ctx, ISSUE_TEMPLATE_KEY, IssueTemplateCandidates) | setTemplateIfExists(ctx, ISSUE_TEMPLATE_KEY, IssueTemplateCandidates) | ||||
| renderAttachmentSettings(ctx) | renderAttachmentSettings(ctx) | ||||
| @@ -339,10 +341,6 @@ func NewIssue(ctx *context.Context) { | |||||
| return | return | ||||
| } | } | ||||
| ctx.Data["RequireHighlightJS"] = true | |||||
| ctx.Data["RequireSimpleMDE"] = true | |||||
| ctx.Data["RepoName"] = ctx.Repo.Repository.Name | |||||
| ctx.HTML(200, ISSUE_NEW) | ctx.HTML(200, ISSUE_NEW) | ||||
| } | } | ||||
| @@ -403,7 +401,6 @@ func ValidateRepoMetas(ctx *context.Context, form auth.CreateIssueForm) ([]int64 | |||||
| func NewIssuePost(ctx *context.Context, form auth.CreateIssueForm) { | func NewIssuePost(ctx *context.Context, form auth.CreateIssueForm) { | ||||
| ctx.Data["Title"] = ctx.Tr("repo.issues.new") | ctx.Data["Title"] = ctx.Tr("repo.issues.new") | ||||
| ctx.Data["PageIsIssueList"] = true | ctx.Data["PageIsIssueList"] = true | ||||
| ctx.Data["RepoName"] = ctx.Repo.Repository.Name | |||||
| ctx.Data["RequireHighlightJS"] = true | ctx.Data["RequireHighlightJS"] = true | ||||
| ctx.Data["RequireSimpleMDE"] = true | ctx.Data["RequireSimpleMDE"] = true | ||||
| renderAttachmentSettings(ctx) | renderAttachmentSettings(ctx) | ||||
| @@ -493,6 +490,8 @@ func UploadIssueAttachment(ctx *context.Context) { | |||||
| } | } | ||||
| func ViewIssue(ctx *context.Context) { | func ViewIssue(ctx *context.Context) { | ||||
| ctx.Data["RequireHighlightJS"] = true | |||||
| ctx.Data["RequireSimpleMDE"] = true | |||||
| ctx.Data["RequireDropzone"] = true | ctx.Data["RequireDropzone"] = true | ||||
| renderAttachmentSettings(ctx) | renderAttachmentSettings(ctx) | ||||
| @@ -637,11 +636,6 @@ func ViewIssue(ctx *context.Context) { | |||||
| ctx.Data["Issue"] = issue | ctx.Data["Issue"] = issue | ||||
| ctx.Data["IsIssueOwner"] = ctx.Repo.IsWriter() || (ctx.IsSigned && issue.IsPoster(ctx.User.ID)) | ctx.Data["IsIssueOwner"] = ctx.Repo.IsWriter() || (ctx.IsSigned && issue.IsPoster(ctx.User.ID)) | ||||
| ctx.Data["SignInLink"] = setting.AppSubUrl + "/user/login?redirect_to=" + ctx.Data["Link"].(string) | ctx.Data["SignInLink"] = setting.AppSubUrl + "/user/login?redirect_to=" + ctx.Data["Link"].(string) | ||||
| ctx.Data["RequireHighlightJS"] = true | |||||
| ctx.Data["RequireSimpleMDE"] = true | |||||
| ctx.Data["RepoName"] = ctx.Repo.Repository.Name | |||||
| ctx.HTML(200, ISSUE_VIEW) | ctx.HTML(200, ISSUE_VIEW) | ||||
| } | } | ||||
| @@ -39,7 +39,7 @@ func UploadFile(ctx *context.Context) { | |||||
| repoName := ctx.Repo.Repository.Name | repoName := ctx.Repo.Repository.Name | ||||
| branchName := ctx.Repo.BranchName | branchName := ctx.Repo.BranchName | ||||
| branchLink := ctx.Repo.RepoLink + "/src/" + branchName | branchLink := ctx.Repo.RepoLink + "/src/" + branchName | ||||
| treeName := ctx.Repo.TreeName | |||||
| treeName := ctx.Repo.TreePath | |||||
| treeNames := []string{""} | treeNames := []string{""} | ||||
| if len(treeName) > 0 { | if len(treeName) > 0 { | ||||
| @@ -56,7 +56,7 @@ func Home(ctx *context.Context) { | |||||
| uploadFileLink := ctx.Repo.RepoLink + "/upload/" + branchName | uploadFileLink := ctx.Repo.RepoLink + "/upload/" + branchName | ||||
| // Get tree path | // Get tree path | ||||
| treename := ctx.Repo.TreeName | |||||
| treename := ctx.Repo.TreePath | |||||
| if len(treename) > 0 { | if len(treename) > 0 { | ||||
| if treename[len(treename)-1] == '/' { | if treename[len(treename)-1] == '/' { | ||||
| @@ -1 +1 @@ | |||||
| 0.9.84.0824 | |||||
| 0.9.85.0824 | |||||
| @@ -8,7 +8,7 @@ | |||||
| <input type="hidden" name="last_commit" value="{{.last_commit}}"> | <input type="hidden" name="last_commit" value="{{.last_commit}}"> | ||||
| <div class="ui secondary menu"> | <div class="ui secondary menu"> | ||||
| <div class="fitted item treepath"> | <div class="fitted item treepath"> | ||||
| <div class="ui breadcrumb field {{if .Err_Filename}}error{{end}}"> | |||||
| <div class="ui breadcrumb field {{if .Err_TreePath}}error{{end}}"> | |||||
| <a class="section" href="{{EscapePound $.BranchLink}}">{{.Repository.Name}}</a> | <a class="section" href="{{EscapePound $.BranchLink}}">{{.Repository.Name}}</a> | ||||
| {{ $n := len .TreeNames}} | {{ $n := len .TreeNames}} | ||||
| {{ $l := Subtract $n 1}} | {{ $l := Subtract $n 1}} | ||||
| @@ -22,8 +22,8 @@ | |||||
| {{end}} | {{end}} | ||||
| {{end}} | {{end}} | ||||
| <!-- <button class="clipboard-tree-name octicon octicon-clippy poping up" type="button" data-content="{{.i18n.Tr "repo.copy_file_path_to_clipboard"}}" data-position="bottom center" data-variation="tiny inverted"></button> --> | <!-- <button class="clipboard-tree-name octicon octicon-clippy poping up" type="button" data-content="{{.i18n.Tr "repo.copy_file_path_to_clipboard"}}" data-position="bottom center" data-variation="tiny inverted"></button> --> | ||||
| <span class="repo-edit-file-cancel">{{.i18n.Tr "repo.or"}} <a href="{{EscapePound $.BranchLink}}{{if not .IsNewFile}}/{{EscapePound $.TreeName}}{{end}}">{{.i18n.Tr "repo.cancel_lower"}}</a></span> | |||||
| <input type="hidden" id="tree-name" name="tree_name" value="{{.TreeName}}" required> | |||||
| <span class="repo-edit-file-cancel">{{.i18n.Tr "repo.or"}} <a href="{{EscapePound $.BranchLink}}{{if not .IsNewFile}}/{{EscapePound .TreePath}}{{end}}">{{.i18n.Tr "repo.cancel_lower"}}</a></span> | |||||
| <input type="hidden" id="tree_path" name="tree_path" value="{{.TreePath}}" required> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -32,11 +32,11 @@ | |||||
| <a class="active item" data-tab="write"><i class="octicon octicon-code"></i> {{if .IsNewFile}}{{.i18n.Tr "repo.new_file"}}{{else}}{{.i18n.Tr "repo.edit_file"}}{{end}}</a> | <a class="active item" data-tab="write"><i class="octicon octicon-code"></i> {{if .IsNewFile}}{{.i18n.Tr "repo.new_file"}}{{else}}{{.i18n.Tr "repo.edit_file"}}{{end}}</a> | ||||
| {{if not .IsNewFile}} | {{if not .IsNewFile}} | ||||
| <a class="item" data-tab="preview" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.RepoLink}}" data-preview-file-modes="{{.PreviewableFileModes}}"><i class="octicon octicon-eye"></i> {{.i18n.Tr "repo.release.preview"}}</a> | <a class="item" data-tab="preview" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.RepoLink}}" data-preview-file-modes="{{.PreviewableFileModes}}"><i class="octicon octicon-eye"></i> {{.i18n.Tr "repo.release.preview"}}</a> | ||||
| <a class="item" data-tab="diff" data-url="{{.RepoLink}}/_preview/{{.BranchName}}/{{.TreeName}}" data-context="{{.BranchLink}}"><i class="octicon octicon-diff"></i> {{.i18n.Tr "repo.preview_changes"}}</a> | |||||
| <a class="item" data-tab="diff" data-url="{{.RepoLink}}/_preview/{{.BranchName}}/{{.TreePath}}" data-context="{{.BranchLink}}"><i class="octicon octicon-diff"></i> {{.i18n.Tr "repo.preview_changes"}}</a> | |||||
| {{end}} | {{end}} | ||||
| </div> | </div> | ||||
| <div class="ui bottom attached active tab segment" data-tab="write"> | <div class="ui bottom attached active tab segment" data-tab="write"> | ||||
| <textarea id="edit_area" name="content" data-id="repo-{{.Repository.Name}}-{{.TreeName}}" | |||||
| <textarea id="edit_area" name="content" data-id="repo-{{.Repository.Name}}-{{.TreePath}}" | |||||
| data-url="{{AppSubUrl}}/api/v1/markdown" | data-url="{{AppSubUrl}}/api/v1/markdown" | ||||
| data-context="{{.RepoLink}}" | data-context="{{.RepoLink}}" | ||||
| data-markdown-file-exts="{{.MarkdownFileExts}}" | data-markdown-file-exts="{{.MarkdownFileExts}}" | ||||
| @@ -55,7 +55,7 @@ | |||||
| <div class="commit-form"> | <div class="commit-form"> | ||||
| <h3>{{.i18n.Tr "repo.commit_changes"}}</h3> | <h3>{{.i18n.Tr "repo.commit_changes"}}</h3> | ||||
| <div class="field"> | <div class="field"> | ||||
| <input name="commit_summary" placeholder="{{if .IsNewFile}}{{.i18n.Tr "repo.add"}} '{{.TreeName}}/<filename>'{{else}}{{.i18n.Tr "repo.update"}} '{{.TreeName}}'{{end}}" value="{{.commit_summary}}"> | |||||
| <input name="commit_summary" placeholder="{{if .IsNewFile}}{{.i18n.Tr "repo.add"}} '{{.TreePath}}/<filename>'{{else}}{{.i18n.Tr "repo.update"}} '{{.TreePath}}'{{end}}" value="{{.commit_summary}}"> | |||||
| </div> | </div> | ||||
| <div class="field"> | <div class="field"> | ||||
| <textarea name="commit_message" placeholder="{{.i18n.Tr "repo.default_commit_message"}}" rows="5">{{.commit_message}}</textarea> | <textarea name="commit_message" placeholder="{{.i18n.Tr "repo.default_commit_message"}}" rows="5">{{.commit_message}}</textarea> | ||||
| @@ -80,7 +80,7 @@ | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="quick-pull-branch-name {{if not (eq .commit_choice "commit-to-new-branch")}}hide{{end}}"> | <div class="quick-pull-branch-name {{if not (eq .commit_choice "commit-to-new-branch")}}hide{{end}}"> | ||||
| <div class="new-branch-name-input{{if .Err_Branchname}} error{{end}}"> | |||||
| <div class="new-branch-name-input{{if .Err_NewBranchName}} error{{end}}"> | |||||
| <i class="octicon octicon-git-branch" height="16" width="10"></i> | <i class="octicon octicon-git-branch" height="16" width="10"></i> | ||||
| <input type="text" name="new_branch_name" value="{{.new_branch_name}}" class="form-control input-contrast mr-2 js-quick-pull-new-branch-name" placeholder="New branch name…"> | <input type="text" name="new_branch_name" value="{{.new_branch_name}}" class="form-control input-contrast mr-2 js-quick-pull-new-branch-name" placeholder="New branch name…"> | ||||
| <span class="text-muted js-quick-pull-normalization-info"></span> | <span class="text-muted js-quick-pull-normalization-info"></span> | ||||
| @@ -91,7 +91,7 @@ | |||||
| <button type="submit" class="ui green button"> | <button type="submit" class="ui green button"> | ||||
| {{.i18n.Tr "repo.commit_changes"}} | {{.i18n.Tr "repo.commit_changes"}} | ||||
| </button> | </button> | ||||
| <a class="ui button red" href="{{EscapePound $.BranchLink}}/{{EscapePound $.TreeName}}">{{.i18n.Tr "repo.cancel"}}</a> | |||||
| <a class="ui button red" href="{{EscapePound $.BranchLink}}/{{EscapePound .TreePath}}">{{.i18n.Tr "repo.cancel"}}</a> | |||||
| </div> | </div> | ||||
| </form> | </form> | ||||
| </div> | </div> | ||||
| @@ -2,6 +2,7 @@ | |||||
| <div class="repository file list"> | <div class="repository file list"> | ||||
| {{template "repo/header" .}} | {{template "repo/header" .}} | ||||
| <div class="ui container"> | <div class="ui container"> | ||||
| {{template "base/alert" .}} | |||||
| <p id="repo-desc"> | <p id="repo-desc"> | ||||
| {{if .Repository.DescriptionHtml}}<span class="description has-emoji">{{.Repository.DescriptionHtml}}</span>{{else}}<span class="no-description text-italic">{{.i18n.Tr "repo.no_desc"}}</span>{{end}} | {{if .Repository.DescriptionHtml}}<span class="description has-emoji">{{.Repository.DescriptionHtml}}</span>{{else}}<span class="no-description text-italic">{{.i18n.Tr "repo.no_desc"}}</span>{{end}} | ||||
| <a class="link" href="{{.Repository.Website}}">{{.Repository.Website}}</a> | <a class="link" href="{{.Repository.Website}}">{{.Repository.Website}}</a> | ||||