Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull request with long commit message in title fails to open #16507

Closed
1 of 6 tasks
amber-ailuridae opened this issue Jul 21, 2021 · 4 comments · Fixed by #16517
Closed
1 of 6 tasks

Pull request with long commit message in title fails to open #16507

amber-ailuridae opened this issue Jul 21, 2021 · 4 comments · Fixed by #16517

Comments

@amber-ailuridae
Copy link

amber-ailuridae commented Jul 21, 2021

  • Gitea version (or commit ref): try.gitea.io version (1.16.0+dev-28-g28f6f7bb0)
  • Git version: 2.30.0.windows.2
  • Operating system: Microsoft Windows 10 Pro, Version 10.0.19042 Build 19042
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
  • Log gist:
    Browser logs enumerated below.
    duh:1 Tracking Prevention blocked access to storage for https://secure.gravatar.com/avatar/e64fbf2d101290423cd7c42d02c378b0?d=identicon&s=96.
    duh:1 Tracking Prevention blocked access to storage for https://secure.gravatar.com/avatar/e64fbf2d101290423cd7c42d02c378b0?d=identicon&s=112.
    index.js?v=37edd3a08b9e064018380614f83a1b4b:62 jQuery.Deferred exception: SimpleMDE is not defined ReferenceError: SimpleMDE is not defined
      at Ba (https://try.gitea.io/assets/js/index.js?v=37edd3a08b9e064018380614f83a1b4b:60:1714)
      at Xm (https://try.gitea.io/assets/js/index.js?v=37edd3a08b9e064018380614f83a1b4b:29:33228)
      at https://try.gitea.io/assets/js/index.js?v=37edd3a08b9e064018380614f83a1b4b:62:20111
      at Generator.next (<anonymous>)
      at u (https://try.gitea.io/assets/js/index.js?v=37edd3a08b9e064018380614f83a1b4b:29:26053) undefined
    o.Deferred.exceptionHook @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    Pi @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    (anonymous) @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    Promise.then (async)
    Lt @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    Pi @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    setTimeout (async)
    (anonymous) @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    je @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    fireWith @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    fire @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    je @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    fireWith @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    ready @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    We @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    index.js?v=37edd3a08b9e064018380614f83a1b4b:60 Uncaught ReferenceError: SimpleMDE is not defined
      at Ba (index.js?v=37edd3a08b9e064018380614f83a1b4b:60)
      at Xm (index.js?v=37edd3a08b9e064018380614f83a1b4b:29)
      at index.js?v=37edd3a08b9e064018380614f83a1b4b:62
      at Generator.next (<anonymous>)
      at u (index.js?v=37edd3a08b9e064018380614f83a1b4b:29)
    Ba @ index.js?v=37edd3a08b9e064018380614f83a1b4b:60
    Xm @ index.js?v=37edd3a08b9e064018380614f83a1b4b:29
    (anonymous) @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    u @ index.js?v=37edd3a08b9e064018380614f83a1b4b:29
    setTimeout (async)
    o.readyException @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    (anonymous) @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    Lt @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    Pi @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    setTimeout (async)
    (anonymous) @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    je @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    fireWith @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    fire @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    je @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    fireWith @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    Pi @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    (anonymous) @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    Promise.then (async)
    Lt @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    Pi @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    setTimeout (async)
    (anonymous) @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    je @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    fireWith @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    fire @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    je @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    fireWith @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    ready @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    We @ index.js?v=37edd3a08b9e064018380614f83a1b4b:62
    

Description

If you create a pull request from a commit with a very long commit message (>255 characters) and try to open a pull request without trimming down the title, opening the pull request will fail without any error notification. Typically, if you try to create a commit message longer than 100 characters in the UI, it will tell you to shorten the message. Furthermore, if you try to create a pull request with too long of a title, the input box will prevent you from typing more characters. However, this can be circumvented. This issue can be reproduced by:

  1. Creating a commit with a very long message (>255 characters) on your local machine.
  2. Pushing the commit to Gitea.
  3. Creating a pull request with only that commit.
  4. Selecting Create Pull Request on the New Pull Request page without editing the title.

I was able to replicate this issue on try.gitea.io, but I also can replicate it on my private Gitea instance running 1.13.2 with PostgreSQL. This issue arose when a developer on my team said that they could not open a pull request. We sat down and troubleshooted the issue, narrowing it down to this problem.

The only fix this really needs is some kind of error message that notifies the user that they need to trim down their PR title.

Screenshots

2021-07-21_9-29-15.mp4
@zeripath
Copy link
Contributor

There will be an error being returned from the create pull request that is not being handled correctly.

Are you able to provide server logs from when the pull request is attempted to be created?

@amber-ailuridae
Copy link
Author

Here are the logs at debug level when I make the POST request to open a PR. Let me know if you need SQL logs or trace-level logs.

2021/07/22 13:15:33 Started POST /testadmin/test-repo/compare/master...feature/test for 172.21.0.1:59026


2021/07/22 13:15:33 ...s/context/context.go:740:1() [D] Session ID: 8c3dc69846efeace

2021/07/22 13:15:33 ...s/context/context.go:741:1() [D] CSRF Token: _ygFUFpZyBktog_kkHyMBQYS9wA6MTYyNjk1Njg5NDU1NDM1NzAwMA

2021/07/22 13:15:33 ...dules/git/command.go:120:RunInDirTimeoutEnvFullPipelineFunc() [D] /data/git/repositories/testadmin/test-repo.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= show-ref --tags

2021/07/22 13:15:33 ...dules/git/command.go:120:RunInDirTimeoutEnvFullPipelineFunc() [D] /data/git/repositories/testadmin/test-repo.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch

2021/07/22 13:15:33 ...dules/git/command.go:120:RunInDirTimeoutEnvFullPipelineFunc() [D] /data/git/repositories/testadmin/test-repo.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch-check


2021/07/22 13:15:33 ...dules/git/command.go:120:RunInDirTimeoutEnvFullPipelineFunc() [D] /data/git/repositories/testadmin/test-repo.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= show-ref --heads


2021/07/22 13:15:33 ...dules/git/command.go:120:RunInDirTimeoutEnvFullPipelineFunc() [D] /data/git/repositories/testadmin/test-repo.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file -e master


2021/07/22 13:15:33 ...dules/git/command.go:120:RunInDirTimeoutEnvFullPipelineFunc() [D] /data/git/repositories/testadmin/test-repo.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file -e feature/test


2021/07/22 13:15:34 ...dules/git/command.go:120:RunInDirTimeoutEnvFullPipelineFunc() [D] /data/git/repositories/testadmin/test-repo.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= rev-parse refs/heads/feature/test


2021/07/22 13:15:34 ...dules/git/command.go:120:RunInDirTimeoutEnvFullPipelineFunc() [D] /data/git/repositories/testadmin/test-repo.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= merge-base -- refs/heads/master refs/heads/feature/test


2021/07/22 13:15:34 ...dules/git/command.go:120:RunInDirTimeoutEnvFullPipelineFunc() [D] /data/git/repositories/testadmin/test-repo.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= rev-parse refs/heads/master


2021/07/22 13:15:34 ...dules/git/command.go:120:RunInDirTimeoutEnvFullPipelineFunc() [D] /data/git/repositories/testadmin/test-repo.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= log 7ad09021f75aff079edc22f40e3c32450737ac9b...refs/heads/feature/test --pretty=format:%H


2021/07/22 13:15:34 ...dules/git/command.go:120:RunInDirTimeoutEnvFullPipelineFunc() [D] /data/git/repositories/testadmin/test-repo.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= diff -z --name-only refs/heads/master...refs/heads/feature/test


2021/07/22 13:15:34 ...dules/git/command.go:120:RunInDirTimeoutEnvFullPipelineFunc() [D] /data/git/repositories/testadmin/test-repo.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= show-ref --heads


2021/07/22 13:15:34 ...dules/git/command.go:120:RunInDirTimeoutEnvFullPipelineFunc() [D] /data/git/repositories/testadmin/test-repo.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch-check

2021/07/22 13:15:34 ...dules/git/command.go:120:RunInDirTimeoutEnvFullPipelineFunc() [D] /data/git/repositories/testadmin/test-repo.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= cat-file --batch


2021/07/22 13:15:34 ...s/charset/charset.go:135:DetectEncoding() [D] Detected encoding: utf-8 (fast)

2021/07/22 13:15:34 ...s/charset/charset.go:135:DetectEncoding() [D] Detected encoding: utf-8 (fast)


2021/07/22 13:15:34 ...dules/git/command.go:120:RunInDirTimeoutEnvFullPipelineFunc() [D] /data/git/repositories/testadmin/test-repo.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= diff --shortstat 7ad09021f75aff079edc22f40e3c32450737ac9b...c1d8f2d1115efc19e116ff4c526036b7d5db94d9


2021/07/22 13:15:34 ...s/context/context.go:185:HTML() [D] Template: repo/diff/compare


2021/07/22 13:15:34 Completed POST /testadmin/test-repo/compare/master...feature/test 200 OK in 717.7422ms

@zeripath
Copy link
Contributor

zeripath commented Jul 22, 2021

hmm... not greatly useful...

OK I've worked it out and pushed up a PR to fix this.

zeripath added a commit to zeripath/gitea that referenced this issue Jul 22, 2021
The CompareAndPullRequestPost handler for POST to /compare
incorrectly handles returning errors to the user. For a start
it does not set the necessary markers to switch SimpleMDE
but it also does not immediately return to the form.

This PR fixes this by setting the appropriate values, fixing
the templates and preventing the suggestion of a too long
title.

Fix go-gitea#16507

Signed-off-by: Andrew Thornton <art27@cantab.net>
zeripath added a commit that referenced this issue Jul 25, 2021
The CompareAndPullRequestPost handler for POST to /compare
incorrectly handles returning errors to the user. For a start
it does not set the necessary markers to switch SimpleMDE
but it also does not immediately return to the form.

This PR fixes this by setting the appropriate values, fixing
the templates and preventing the suggestion of a too long
title.

Fix #16507

Signed-off-by: Andrew Thornton <art27@cantab.net>
zeripath added a commit to zeripath/gitea that referenced this issue Jul 26, 2021
Backport go-gitea#16517

The CompareAndPullRequestPost handler for POST to /compare
incorrectly handles returning errors to the user. For a start
it does not set the necessary markers to switch SimpleMDE
but it also does not immediately return to the form.

This PR fixes this by setting the appropriate values, fixing
the templates and preventing the suggestion of a too long
title.

Fix go-gitea#16507

Signed-off-by: Andrew Thornton <art27@cantab.net>
6543 pushed a commit that referenced this issue Jul 26, 2021
Backport #16517

The CompareAndPullRequestPost handler for POST to /compare
incorrectly handles returning errors to the user. For a start
it does not set the necessary markers to switch SimpleMDE
but it also does not immediately return to the form.

This PR fixes this by setting the appropriate values, fixing
the templates and preventing the suggestion of a too long
title.

Fix #16507

Signed-off-by: Andrew Thornton <art27@cantab.net>
@amber-ailuridae
Copy link
Author

hmm... not greatly useful...

OK I've worked it out and pushed up a PR to fix this.

Thank you so much!

AbdulrhmnGhanem pushed a commit to kitspace/gitea that referenced this issue Aug 10, 2021
The CompareAndPullRequestPost handler for POST to /compare
incorrectly handles returning errors to the user. For a start
it does not set the necessary markers to switch SimpleMDE
but it also does not immediately return to the form.

This PR fixes this by setting the appropriate values, fixing
the templates and preventing the suggestion of a too long
title.

Fix go-gitea#16507

Signed-off-by: Andrew Thornton <art27@cantab.net>
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants