From a9d7055ea4d1420c5bdda5481f9df9c84d1b67a8 Mon Sep 17 00:00:00 2001
From: Lunny Xiao <xiaolunwen@gmail.com>
Date: Fri, 11 Feb 2022 12:46:33 +0800
Subject: [PATCH 1/2] Fix broken cacnel button link on patch page

---
 routers/web/repo/patch.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/routers/web/repo/patch.go b/routers/web/repo/patch.go
index b00065a6ee9df..38e3288fab3ca 100644
--- a/routers/web/repo/patch.go
+++ b/routers/web/repo/patch.go
@@ -28,7 +28,7 @@ func NewDiffPatch(ctx *context.Context) {
 
 	canCommit := renderCommitRights(ctx)
 
-	ctx.Data["TreePath"] = "patch"
+	ctx.Data["TreePath"] = ""
 
 	ctx.Data["commit_summary"] = ""
 	ctx.Data["commit_message"] = ""

From 9f98839166e2c890377e1f868476cc05a543fdbe Mon Sep 17 00:00:00 2001
From: Andrew Thornton <art27@cantab.net>
Date: Sat, 12 Feb 2022 11:21:58 +0000
Subject: [PATCH 2/2] remove treepath="patch" elsewhere too

Signed-off-by: Andrew Thornton <art27@cantab.net>
---
 routers/web/repo/cherry_pick.go  | 2 +-
 routers/web/repo/patch.go        | 2 +-
 templates/repo/editor/patch.tmpl | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/routers/web/repo/cherry_pick.go b/routers/web/repo/cherry_pick.go
index 1b0d8452e2baf..eb228093480d3 100644
--- a/routers/web/repo/cherry_pick.go
+++ b/routers/web/repo/cherry_pick.go
@@ -50,7 +50,7 @@ func CherryPick(ctx *context.Context) {
 	ctx.Data["RequireHighlightJS"] = true
 
 	canCommit := renderCommitRights(ctx)
-	ctx.Data["TreePath"] = "patch"
+	ctx.Data["TreePath"] = ""
 
 	if canCommit {
 		ctx.Data["commit_choice"] = frmCommitChoiceDirect
diff --git a/routers/web/repo/patch.go b/routers/web/repo/patch.go
index 38e3288fab3ca..e08cde89f2e5b 100644
--- a/routers/web/repo/patch.go
+++ b/routers/web/repo/patch.go
@@ -55,7 +55,7 @@ func NewDiffPatchPost(ctx *context.Context) {
 		branchName = form.NewBranchName
 	}
 	ctx.Data["RequireHighlightJS"] = true
-	ctx.Data["TreePath"] = "patch"
+	ctx.Data["TreePath"] = ""
 	ctx.Data["BranchLink"] = ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchNameSubURL()
 	ctx.Data["FileContent"] = form.Content
 	ctx.Data["commit_summary"] = form.CommitSummary
diff --git a/templates/repo/editor/patch.tmpl b/templates/repo/editor/patch.tmpl
index cecda907a43d3..c108d09159537 100644
--- a/templates/repo/editor/patch.tmpl
+++ b/templates/repo/editor/patch.tmpl
@@ -15,7 +15,7 @@
 						<div class="divider">:</div>
 						<a class="section" href="{{$.BranchLink}}">{{.BranchName}}</a>
 						<span>{{.i18n.Tr "repo.editor.or"}} <a href="{{$.BranchLink}}">{{.i18n.Tr "repo.editor.cancel_lower"}}</a></span>
-						<input type="hidden" id="tree_path" name="tree_path" value="patch" required>
+						<input type="hidden" id="tree_path" name="tree_path" value="" required>
 						<input id="file-name" type="hidden" value="diff.patch">
 					</div>
 				</div>