mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-17 00:01:00 -04:00
Compare commits
3 Commits
a89b399faa
...
40ba750c4b
Author | SHA1 | Date | |
---|---|---|---|
|
40ba750c4b | ||
|
2774671584 | ||
|
d6b96627c1 |
@ -1036,6 +1036,9 @@ ROUTER = console
|
|||||||
;;
|
;;
|
||||||
;; Add co-authored-by and co-committed-by trailers if committer does not match author
|
;; Add co-authored-by and co-committed-by trailers if committer does not match author
|
||||||
;ADD_CO_COMMITTER_TRAILERS = true
|
;ADD_CO_COMMITTER_TRAILERS = true
|
||||||
|
;;
|
||||||
|
;; In addition to testing patches using the three-way merge method, re-test conflicting patches with git apply
|
||||||
|
;TEST_CONFLICTING_PATCHES_WITH_GIT_APPLY = false
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@ -134,6 +134,7 @@ In addition there is _`StaticRootPath`_ which can be set as a built-in at build
|
|||||||
- `DEFAULT_MERGE_MESSAGE_OFFICIAL_APPROVERS_ONLY`: **true**: In default merge messages only include approvers who are officially allowed to review.
|
- `DEFAULT_MERGE_MESSAGE_OFFICIAL_APPROVERS_ONLY`: **true**: In default merge messages only include approvers who are officially allowed to review.
|
||||||
- `POPULATE_SQUASH_COMMENT_WITH_COMMIT_MESSAGES`: **false**: In default squash-merge messages include the commit message of all commits comprising the pull request.
|
- `POPULATE_SQUASH_COMMENT_WITH_COMMIT_MESSAGES`: **false**: In default squash-merge messages include the commit message of all commits comprising the pull request.
|
||||||
- `ADD_CO_COMMITTER_TRAILERS`: **true**: Add co-authored-by and co-committed-by trailers to merge commit messages if committer does not match author.
|
- `ADD_CO_COMMITTER_TRAILERS`: **true**: Add co-authored-by and co-committed-by trailers to merge commit messages if committer does not match author.
|
||||||
|
- `TEST_CONFLICTING_PATCHES_WITH_GIT_APPLY`: **false**: PR patches are tested using a three-way merge method to discover if there are conflicts. If this setting is set to **true**, conflicting patches will be retested using `git apply` - This was the previous behaviour in 1.18 (and earlier) but is somewhat inefficient. Please report if you find that this setting is required.
|
||||||
|
|
||||||
### Repository - Issue (`repository.issue`)
|
### Repository - Issue (`repository.issue`)
|
||||||
|
|
||||||
|
@ -82,6 +82,7 @@ var (
|
|||||||
DefaultMergeMessageOfficialApproversOnly bool
|
DefaultMergeMessageOfficialApproversOnly bool
|
||||||
PopulateSquashCommentWithCommitMessages bool
|
PopulateSquashCommentWithCommitMessages bool
|
||||||
AddCoCommitterTrailers bool
|
AddCoCommitterTrailers bool
|
||||||
|
TestConflictingPatchesWithGitApply bool
|
||||||
} `ini:"repository.pull-request"`
|
} `ini:"repository.pull-request"`
|
||||||
|
|
||||||
// Issue Setting
|
// Issue Setting
|
||||||
@ -204,6 +205,7 @@ var (
|
|||||||
DefaultMergeMessageOfficialApproversOnly bool
|
DefaultMergeMessageOfficialApproversOnly bool
|
||||||
PopulateSquashCommentWithCommitMessages bool
|
PopulateSquashCommentWithCommitMessages bool
|
||||||
AddCoCommitterTrailers bool
|
AddCoCommitterTrailers bool
|
||||||
|
TestConflictingPatchesWithGitApply bool
|
||||||
}{
|
}{
|
||||||
WorkInProgressPrefixes: []string{"WIP:", "[WIP]"},
|
WorkInProgressPrefixes: []string{"WIP:", "[WIP]"},
|
||||||
// Same as GitHub. See
|
// Same as GitHub. See
|
||||||
|
@ -12,8 +12,13 @@ import (
|
|||||||
// TimeStamp defines a timestamp
|
// TimeStamp defines a timestamp
|
||||||
type TimeStamp int64
|
type TimeStamp int64
|
||||||
|
|
||||||
// mock is NOT concurrency-safe!!
|
var (
|
||||||
var mock time.Time
|
// mock is NOT concurrency-safe!!
|
||||||
|
mock time.Time
|
||||||
|
|
||||||
|
// Used for IsZero, to check if timestamp is the zero time instant.
|
||||||
|
timeZeroUnix = time.Time{}.Unix()
|
||||||
|
)
|
||||||
|
|
||||||
// Set sets the time to a mocked time.Time
|
// Set sets the time to a mocked time.Time
|
||||||
func Set(now time.Time) {
|
func Set(now time.Time) {
|
||||||
@ -102,5 +107,5 @@ func (ts TimeStamp) FormatDate() string {
|
|||||||
|
|
||||||
// IsZero is zero time
|
// IsZero is zero time
|
||||||
func (ts TimeStamp) IsZero() bool {
|
func (ts TimeStamp) IsZero() bool {
|
||||||
return int64(ts) == 0
|
return int64(ts) == 0 || int64(ts) == timeZeroUnix
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/process"
|
"code.gitea.io/gitea/modules/process"
|
||||||
repo_module "code.gitea.io/gitea/modules/repository"
|
repo_module "code.gitea.io/gitea/modules/repository"
|
||||||
|
"code.gitea.io/gitea/modules/setting"
|
||||||
"code.gitea.io/gitea/modules/util"
|
"code.gitea.io/gitea/modules/util"
|
||||||
|
|
||||||
"github.com/gobwas/glob"
|
"github.com/gobwas/glob"
|
||||||
@ -289,13 +290,15 @@ func checkConflicts(ctx context.Context, pr *issues_model.PullRequest, gitRepo *
|
|||||||
|
|
||||||
// 2. AttemptThreeWayMerge first - this is much quicker than plain patch to base
|
// 2. AttemptThreeWayMerge first - this is much quicker than plain patch to base
|
||||||
description := fmt.Sprintf("PR[%d] %s/%s#%d", pr.ID, pr.BaseRepo.OwnerName, pr.BaseRepo.Name, pr.Index)
|
description := fmt.Sprintf("PR[%d] %s/%s#%d", pr.ID, pr.BaseRepo.OwnerName, pr.BaseRepo.Name, pr.Index)
|
||||||
conflict, _, err := AttemptThreeWayMerge(ctx,
|
conflict, conflictFiles, err := AttemptThreeWayMerge(ctx,
|
||||||
tmpBasePath, gitRepo, pr.MergeBase, "base", "tracking", description)
|
tmpBasePath, gitRepo, pr.MergeBase, "base", "tracking", description)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !conflict {
|
if !conflict {
|
||||||
|
// No conflicts detected so we need to check if the patch is empty...
|
||||||
|
// a. Write the newly merged tree and check the new tree-hash
|
||||||
var treeHash string
|
var treeHash string
|
||||||
treeHash, _, err = git.NewCommand(ctx, "write-tree").RunStdString(&git.RunOpts{Dir: tmpBasePath})
|
treeHash, _, err = git.NewCommand(ctx, "write-tree").RunStdString(&git.RunOpts{Dir: tmpBasePath})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -307,6 +310,8 @@ func checkConflicts(ctx context.Context, pr *issues_model.PullRequest, gitRepo *
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// b. compare the new tree-hash with the base tree hash
|
||||||
if treeHash == baseTree.ID.String() {
|
if treeHash == baseTree.ID.String() {
|
||||||
log.Debug("PullRequest[%d]: Patch is empty - ignoring", pr.ID)
|
log.Debug("PullRequest[%d]: Patch is empty - ignoring", pr.ID)
|
||||||
pr.Status = issues_model.PullRequestStatusEmpty
|
pr.Status = issues_model.PullRequestStatusEmpty
|
||||||
@ -315,9 +320,17 @@ func checkConflicts(ctx context.Context, pr *issues_model.PullRequest, gitRepo *
|
|||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. OK read-tree has failed so we need to try a different thing - this might actually succeed where the above fails due to whitespace handling.
|
// 3. OK the three-way merge method has detected conflicts
|
||||||
|
// 3a. Are still testing with GitApply? If not set the conflict status and move on
|
||||||
|
if !setting.Repository.PullRequest.TestConflictingPatchesWithGitApply {
|
||||||
|
pr.Status = issues_model.PullRequestStatusConflict
|
||||||
|
pr.ConflictedFiles = conflictFiles
|
||||||
|
|
||||||
// 3a. Create a plain patch from head to base
|
log.Trace("Found %d files conflicted: %v", len(pr.ConflictedFiles), pr.ConflictedFiles)
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3b. Create a plain patch from head to base
|
||||||
tmpPatchFile, err := os.CreateTemp("", "patch")
|
tmpPatchFile, err := os.CreateTemp("", "patch")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Unable to create temporary patch file! Error: %v", err)
|
log.Error("Unable to create temporary patch file! Error: %v", err)
|
||||||
@ -340,7 +353,7 @@ func checkConflicts(ctx context.Context, pr *issues_model.PullRequest, gitRepo *
|
|||||||
patchPath := tmpPatchFile.Name()
|
patchPath := tmpPatchFile.Name()
|
||||||
tmpPatchFile.Close()
|
tmpPatchFile.Close()
|
||||||
|
|
||||||
// 3b. if the size of that patch is 0 - there can be no conflicts!
|
// 3c. if the size of that patch is 0 - there can be no conflicts!
|
||||||
if stat.Size() == 0 {
|
if stat.Size() == 0 {
|
||||||
log.Debug("PullRequest[%d]: Patch is empty - ignoring", pr.ID)
|
log.Debug("PullRequest[%d]: Patch is empty - ignoring", pr.ID)
|
||||||
pr.Status = issues_model.PullRequestStatusEmpty
|
pr.Status = issues_model.PullRequestStatusEmpty
|
||||||
|
@ -32,6 +32,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data: () => ({
|
data: () => ({
|
||||||
colorRange: [
|
colorRange: [
|
||||||
|
'var(--color-secondary-alpha-70)',
|
||||||
'var(--color-secondary-alpha-70)',
|
'var(--color-secondary-alpha-70)',
|
||||||
'var(--color-primary-light-4)',
|
'var(--color-primary-light-4)',
|
||||||
'var(--color-primary-light-2)',
|
'var(--color-primary-light-2)',
|
||||||
@ -50,6 +51,12 @@ export default {
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
// work around issue with first legend color being rendered twice and legend cut off
|
||||||
|
const legend = document.querySelector('.vch__external-legend-wrapper');
|
||||||
|
legend.setAttribute('viewBox', '12 0 80 10');
|
||||||
|
legend.style.marginRight = '-12px';
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleDayClick(e) {
|
handleDayClick(e) {
|
||||||
// Reset filter if same date is clicked
|
// Reset filter if same date is clicked
|
||||||
|
Loading…
x
Reference in New Issue
Block a user