gitea icon indicating copy to clipboard operation
gitea copied to clipboard

PR merge commit fails with large message

Open lafriks opened this issue 1 year ago • 5 comments

Description

When merging PR 500 error is returned and log contains entries:

apr 04 12:52:03 git1 gitea[3331652]: 2024/04/04 12:52:03 ...pull/merge_squash.go:79:doMergeStyleSquash() [E] git commit <PullRequest [45982]lx/demo#224[develop...renovate/node-20.x]>: fork/exec /usr/bin/git: argument list too long
apr 04 12:52:03 git1 gitea[3331652]: 2024/04/04 12:52:03 ...ers/web/repo/pull.go:1302:MergePullRequest() [E] Merge: git commit [lx/demo:renovate/node-20.x -> lx/demo:develop]: fork/exec /usr/bin/git: argument list too long

Should check limit in route handler and return valid error + limit max size in UI

Gitea Version

1.21.10

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

2.25.1

Operating System

Ubuntu 22.04

How are you running Gitea?

Binary

Database

PostgreSQL

lafriks avatar Apr 04 '24 09:04 lafriks

What kind of arguments are passed here? ARG_MAX is 2097152 on a typical linux system, I think we are doing something wrong if we pass such long arguments to git.

silverwind avatar Apr 04 '24 20:04 silverwind

It seems another issue has reported this issue.

It's #28584

lunny avatar Apr 05 '24 03:04 lunny

Some command line tools have options to circumvent argument length limit, like passing args via stdin or a file. Maybe git has something like that too.

silverwind avatar Apr 05 '24 03:04 silverwind

I guess one solution is to use the -r option of git ls-tree and only provide the top-level directories and files as arguments. Won't work in a repo with a million files in root, but I guess no one does that.

git ls-tree -r HEAD web_src

silverwind avatar Apr 05 '24 03:04 silverwind

Imho we should just limit commit message length (warn/trim?)

lafriks avatar Aug 20 '24 18:08 lafriks