mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-22 04:33:42 +09:00
fix: pass merge commit messages to git via stdin (#39269)
`git commit --message=` passes the merge message as a single argument, which Linux caps at 128 KiB and Windows at 32 KiB for the whole command line. Long messages failed with `argument list too long` and the merge box toast showed the raw HTML 500 page. Pass the message via `--file=-` on stdin instead, and answer fetch-action requests with JSON on server errors so the toast shows the error text. Limits merge commit messages to 512KB which could be extended or made configurable later. Fixes: https://github.com/go-gitea/gitea/issues/39261 Fixes: https://github.com/go-gitea/gitea/issues/30276 Signed-off-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -6,6 +6,7 @@ package context
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"gitea.dev/modules/setting"
|
||||
@@ -13,8 +14,12 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestRedirect(t *testing.T) {
|
||||
func TestMain(m *testing.M) {
|
||||
setting.IsInTesting = true
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
func TestRedirect(t *testing.T) {
|
||||
req, _ := http.NewRequest(http.MethodGet, "/", nil)
|
||||
|
||||
cases := []struct {
|
||||
|
||||
Reference in New Issue
Block a user