* CutDiffAroundLine makes the incorrect assumption that `---` and `+++` always represent part of the header of a diff.
This PR adds a flag to its parsing to prevent this problem and adds a streaming parsing technique to CutDiffAroundLine using an io.pipe instead of just sending data to an unbounded buffer.
Fix#14711
Signed-off-by: Andrew Thornton <[email protected]>
* Handle unquoted comment patch files
When making comment patches unfortunately the patch does not always quote the filename
This makes the diff --git header ambiguous again.
This PR finally adds handling for ambiguity in to parse patch
Fix#14812
Signed-off-by: Andrew Thornton <[email protected]>
* Add in testing for no error
There is no way currently for CutDiffAroundLine in this test to cause an
error however, it should still be tested.
Signed-off-by: Andrew Thornton <[email protected]>
Fixes#14187: mention handling extracted from email notification code
Fixes#14013: add notification for mentions in pull request code comments
Fixes#13450: Not receiving any emails with setting "Only Email on Mention"
* remove github.com/unknwon/com from models
* dont use "com.ToStr()"
* replace "com.ToStr" with "fmt.Sprint" where its easy to do
* more refactor
* fix test
* just "proxy" Copy func for now
* as per @lunny
Originally, it was filled by the commit messages of the involved
commits. In this change, we use the headline comment of the pull
request as the commit message when it is a squash merge.
Thanks to @zeripath for suggesting the idea.
Fixes#12365
Co-authored-by: Mura Li <[email protected]>
* Show dropdown with all statuses for commit
* Use popups
* Remove unnecessary change
* Style popup
* Use divided list
* As per @silverwind
* Refactor GetLastCommitStatus
* Missing dropdown on repo home and commit page
* Fix tests
* Make status icon be a part of a link on PR list
* Fix missing translation call
* Indent fix
Co-authored-by: Lunny Xiao <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
Fixes#13683.
The diff snippet that provides context for a code review comment on the pull request timeline page used to be calculated based on the headCommitID. But in 1.13, with PR #13448, this changed to the commitID from the blame for the commented line, which seems to cause these incorrect review comment diff snippets.
Co-authored-by: Lunny Xiao <[email protected]>
fix dst refspec error in 'Push back to upstream' when base branch have
same name with a tag.
fix#13851
Signed-off-by: a1012112796 <[email protected]>
Co-authored-by: 6543 <[email protected]>
Co-authored-by: zeripath <[email protected]>
* When replying to an outdated comment it should not appear on the files page
This happened because the comment took the latest commitID as its base instead of the
reviewID that it was replying to.
There was also no way of creating an already outdated comment - and a
reply to a review on an outdated line should be outdated.
Signed-off-by: Andrew Thornton <[email protected]>
* fix test
Signed-off-by: Andrew Thornton <[email protected]>
* Fix broken migration
Signed-off-by: Andrew Thornton <[email protected]>
* fix mssql
Signed-off-by: Andrew Thornton <[email protected]>
* Create temporary table because ... well MSSQL ...
Signed-off-by: Andrew Thornton <[email protected]>
* Create temporary table because ... well MSSQL ...
Signed-off-by: Andrew Thornton <[email protected]>
* Create temporary table because ... well MSSQL ...
Signed-off-by: Andrew Thornton <[email protected]>
* fix mssql
Signed-off-by: Andrew Thornton <[email protected]>
* move session within the batch
Signed-off-by: Andrew Thornton <[email protected]>
* regen the sqlcmd each time round the loop
Signed-off-by: Andrew Thornton <[email protected]>
* as per @lunny
Signed-off-by: Andrew Thornton <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
* When replying to an outdated comment it should not appear on the files page
This happened because the comment took the latest commitID as its base instead of the
reviewID that it was replying to.
There was also no way of creating an already outdated comment - and a
reply to a review on an outdated line should be outdated.
Signed-off-by: Andrew Thornton <[email protected]>
* fix test
Signed-off-by: Andrew Thornton <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
Go-version constraints ignore pre-releases.
Rather than change the library further this PR simply changes
the git version comparison to use simple version compare ignoring the
issue of pre-releases.
Signed-off-by: Andrew Thornton <[email protected]>
* Add configurable Trust Models
Gitea's default signature verification model differs from GitHub. GitHub
uses signatures to verify that the committer is who they say they are -
meaning that when GitHub makes a signed commit it must be the committer.
The GitHub model prevents re-publishing of commits after revocation of a
key and prevents re-signing of other people's commits to create a
completely trusted repository signed by one key or a set of trusted
keys.
The default behaviour of Gitea in contrast is to always display the
avatar and information related to a signature. This allows signatures to
be decoupled from the committer. That being said, allowing arbitary
users to present other peoples commits as theirs is not necessarily
desired therefore we have a trust model whereby signatures from
collaborators are marked trusted, signatures matching the commit line
are marked untrusted and signatures that match a user in the db but not
the committer line are marked unmatched.
The problem with this model is that this conflicts with Github therefore
we need to provide an option to allow users to choose the Github model
should they wish to.
Signed-off-by: Andrew Thornton <[email protected]>
* Adjust locale strings
Signed-off-by: Andrew Thornton <[email protected]>
* as per @6543
Co-authored-by: 6543 <[email protected]>
* Update models/gpg_key.go
* Add migration for repository
Signed-off-by: Andrew Thornton <[email protected]>
Co-authored-by: 6543 <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
* Prevent NPE on commenting on lines with invalidated comments
Only check for a review if we are replying to a previous review.
Prevent the NPE in #12239 by assuming that a comment without a Review is
non-pending.
Fix#12239
Signed-off-by: Andrew Thornton <[email protected]>
* Add hack around to show the broken comments
Signed-off-by: Andrew Thornton <[email protected]>
* Add migration and remove template hacks
Signed-off-by: Andrew Thornton <[email protected]>
Replace all calls to os.Remove/os.RemoveAll by retrying util.Remove/util.RemoveAll and remove circular dependencies from util.
Fix#12339
Signed-off-by: Andrew Thornton <[email protected]>
Co-authored-by: silverwind <[email protected]>
* Handle more pathological branch and tag names
Signed-off-by: Andrew Thornton <[email protected]>
* Fix failing test
Signed-off-by: Andrew Thornton <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
A pre-receive hook that rejects pushes to refs/pull/index/head
will cause a broken PR which causes an internal server error
whenever it is viewed. This PR handles prevents the internal server
error by handling non-existent pr heads and sends a flash error
informing the creator there was a problem.
Signed-off-by: Andrew Thornton <[email protected]>
* Cache PullRequest Divergence
* only re-calc divergence if AddTestPullRequestTask() is exec
* migrate already open pulls
* finalize
* take care of closed¬-merged+deleted-branch pull requests
* fix nil pointer exeption
Signed-off-by: 6543 <[email protected]>
* try this
* no error its a warn
* init gitea-repositories-meta
* dont use gitDivergence type
* CI.restart()
* CI.restart()
* CI.restart()
* CI.restart()
* check IsUserAllowedToUpdate independend from CommitsBehind
* [suggest] change merge strategy: do not check write access if user in merge white list #10935
(cherry picked from commit ba74fc6389dfcad03c273441a49b54e4d38c86ee)
* fix NPE
* Fix cross compile (#10952)
* Fix cross compile
* Add test for cross compile
* Fix drone
* Fix drone
* Also prevent CC environment not to generate
Co-authored-by: zeripath <[email protected]>
* fix merge box icon color bug (#10974)
that because need some space beturn ``text`` and color defines
Signed-off-by: a1012112796 <[email protected]>
* [skip ci] Updated translations via Crowdin
* Allow X in addition to x in tasks (#10979)
Signed-off-by: Andrew Thornton <[email protected]>
* remove api: merge reqRepoWriter
Co-authored-by: zeripath <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-authored-by: 赵智超 <[email protected]>
Co-authored-by: GiteaBot <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
Co-authored-by: guillep2k <[email protected]>
* Fix rebase conflict detection in git 2.26
Git changed the technique used in rebase from
simple apply-patches to use merge. This breaks
our conflict detection code.
Signed-off-by: Andrew Thornton <[email protected]>
* As per @techknowlogick reduce copying
Signed-off-by: Andrew Thornton <[email protected]>
* Generate Diff and Patch direct from Pull head
Fix#10932
Also fix "Empty Diff/Patch File when pull is merged"
Closes#10934
Signed-off-by: Andrew Thornton <[email protected]>
* Add tests to ensure that diff does not change
Signed-off-by: Andrew Thornton <[email protected]>
* Ensure diffs and pulls pages work if head branch is deleted too
Signed-off-by: Andrew Thornton <[email protected]>
* Switch to use a temporary repository instead of adding remotes to the base gitea repository to prevent deadlocking the base gitea repository.
* Add documentation on how to use func **createTemporaryRepo**
* Handle push rejections and push out-of-date in branch creation and
file upload.
* Remove the duplicated sanitize from services/pull/merge
* Move the errors Err(Merge)PushOutOfDate and ErrPushRejected to
modules/git
* Handle errors better in the upload file dialogs
Fix#10460
Signed-off-by: Andrew Thornton <[email protected]>
Co-authored-by: guillep2k <[email protected]>
* Display pull request head branch even the branch deleted or repository deleted
* Merge getHeadRepo/loadHeadRepo and getBaseRepo/loadBaseRepo on pull and fill repo when pr.Issue.Repo is available
* retrieve sha from pull head when pull request branch deleted and fix tests
* Fix test
* Ensure MustHeadRepoName returns empty string if no head repo
Co-authored-by: zeripath <[email protected]>