aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo/branch.go
diff options
context:
space:
mode:
authorJakobDev <jakobdev@gmx.de>2022-09-15 15:25:16 +0200
committerGitHub <noreply@github.com>2022-09-15 21:25:16 +0800
commitbf325d44120c4a6fc7f67ff1dc25db770247c9a7 (patch)
treec685496a02305cedcaa6be45f864a1ece6aadd93 /routers/web/repo/branch.go
parentef40324c431a6cf58ff775128da48fc48c9852fe (diff)
downloadgitea-bf325d44120c4a6fc7f67ff1dc25db770247c9a7.tar.gz
gitea-bf325d44120c4a6fc7f67ff1dc25db770247c9a7.zip
Keep path when creating a new branch (#21153)
If you are create a new new branch while viewing file or directory, you get redirected to the root of the repo. With this PR, you keep your current path instead of getting redirected to the repo root.
Diffstat (limited to 'routers/web/repo/branch.go')
-rw-r--r--routers/web/repo/branch.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/web/repo/branch.go b/routers/web/repo/branch.go
index d14ba6cbe9..d1f1255db4 100644
--- a/routers/web/repo/branch.go
+++ b/routers/web/repo/branch.go
@@ -427,5 +427,5 @@ func CreateBranch(ctx *context.Context) {
}
ctx.Flash.Success(ctx.Tr("repo.branch.create_success", form.NewBranchName))
- ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(form.NewBranchName))
+ ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(form.NewBranchName) + "/" + util.PathEscapeSegments(form.CurrentPath))
}