From f8cb1e66d514f38c855f286785aba930b43978dc Mon Sep 17 00:00:00 2001 From: Bart van der Braak Date: Wed, 18 Dec 2024 11:50:50 +0100 Subject: [PATCH] Remove redundant patch due to inclusion upstream Applying: BLENDER: Fix overflow menu flickering on mobile Using index info to reconstruct a base tree... M web_src/js/webcomponents/overflow-menu.js Falling back to patching base and 3-way merge... No changes -- Patch already applied. Applying: BLENDER: Fix slow patch checking with commits that add or remove many files Using index info to reconstruct a base tree... M modules/git/repo_index.go M services/pull/patch.go Falling back to patching base and 3-way merge... Auto-merging services/pull/patch.go Auto-merging modules/git/repo_index.go No changes -- Patch already applied. --- patches/2024-06-25_13-25-27_47b8beb7c8.patch | 40 ----- patches/2024-06-27_17-46-19_57f1c317be.patch | 159 ------------------- 2 files changed, 199 deletions(-) delete mode 100644 patches/2024-06-25_13-25-27_47b8beb7c8.patch delete mode 100644 patches/2024-06-27_17-46-19_57f1c317be.patch diff --git a/patches/2024-06-25_13-25-27_47b8beb7c8.patch b/patches/2024-06-25_13-25-27_47b8beb7c8.patch deleted file mode 100644 index ecd150f13922b..0000000000000 --- a/patches/2024-06-25_13-25-27_47b8beb7c8.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 47b8beb7c8b03711df5e7d013ca71c9cde573002 Mon Sep 17 00:00:00 2001 -From: Brecht Van Lommel -Date: Tue, 25 Jun 2024 13:25:27 +0200 -Subject: [PATCH] BLENDER: Fix overflow menu flickering on mobile - -Submitted upstream as 31484, to be removed when that lands. ---- - web_src/js/webcomponents/overflow-menu.js | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/web_src/js/webcomponents/overflow-menu.js b/web_src/js/webcomponents/overflow-menu.js -index 80dd1a545b4e1..9fe8caba445bf 100644 ---- a/web_src/js/webcomponents/overflow-menu.js -+++ b/web_src/js/webcomponents/overflow-menu.js -@@ -61,6 +61,7 @@ window.customElements.define('overflow-menu', class extends HTMLElement { - } - - const itemFlexSpace = this.menuItemsEl.querySelector('.item-flex-space'); -+ const itemOverFlowMenuButton = this.querySelector('.overflow-menu-button'); - - // move items in tippy back into the menu items for subsequent measurement - for (const item of this.tippyItems || []) { -@@ -72,7 +73,9 @@ window.customElements.define('overflow-menu', class extends HTMLElement { - } - - // measure which items are partially outside the element and move them into the button menu -+ // flex space and overflow menu are excluded from measurement - itemFlexSpace?.style.setProperty('display', 'none', 'important'); -+ itemOverFlowMenuButton?.style.setProperty('display', 'none', 'important'); - this.tippyItems = []; - const menuRight = this.offsetLeft + this.offsetWidth; - const menuItems = this.menuItemsEl.querySelectorAll('.item, .item-flex-space'); -@@ -89,6 +92,7 @@ window.customElements.define('overflow-menu', class extends HTMLElement { - } - } - itemFlexSpace?.style.removeProperty('display'); -+ itemOverFlowMenuButton?.style.removeProperty('display'); - - // if there are no overflown items, remove any previously created button - if (!this.tippyItems?.length) { diff --git a/patches/2024-06-27_17-46-19_57f1c317be.patch b/patches/2024-06-27_17-46-19_57f1c317be.patch deleted file mode 100644 index 3e681d27dc42e..0000000000000 --- a/patches/2024-06-27_17-46-19_57f1c317be.patch +++ /dev/null @@ -1,159 +0,0 @@ -From 57f1c317bef32763eb443412884015a98d92a802 Mon Sep 17 00:00:00 2001 -From: Brecht Van Lommel -Date: Thu, 27 Jun 2024 17:46:19 +0200 -Subject: [PATCH] BLENDER: Fix slow patch checking with commits that add or - remove many files - -Running git update-index for every individual file is slow, so add and remove everything with a single git command. - -When such a big commit lands in the default branch, it could cause PR creation and patch checking for all open PRs to be slow, or time out entirely. For example, a commit that removes 1383 files was measured to take more than 60 seconds and timed out. With this change checking took about a second. - -This is related to #27967, though this will not help with commits that change many lines in few files. - -Co-authored-by: Brecht Van Lommel ---- - modules/git/repo_index.go | 35 +++++++++++++++++++++++++++-------- - services/pull/patch.go | 29 +++++++++++++++++++++-------- - 2 files changed, 48 insertions(+), 16 deletions(-) - -diff --git a/modules/git/repo_index.go b/modules/git/repo_index.go -index 6aaab242c1933..839057009872e 100644 ---- a/modules/git/repo_index.go -+++ b/modules/git/repo_index.go -@@ -104,11 +104,8 @@ func (repo *Repository) RemoveFilesFromIndex(filenames ...string) error { - buffer := new(bytes.Buffer) - for _, file := range filenames { - if file != "" { -- buffer.WriteString("0 ") -- buffer.WriteString(objectFormat.EmptyObjectID().String()) -- buffer.WriteByte('\t') -- buffer.WriteString(file) -- buffer.WriteByte('\000') -+ // using format: mode SP type SP sha1 TAB path -+ buffer.WriteString("0 blob " + objectFormat.EmptyObjectID().String() + "\t" + file + "\000") - } - } - return cmd.Run(&RunOpts{ -@@ -119,11 +116,33 @@ func (repo *Repository) RemoveFilesFromIndex(filenames ...string) error { - }) - } - -+type IndexObjectInfo struct { -+ Mode string -+ Object ObjectID -+ Filename string -+} -+ -+// AddObjectsToIndex adds the provided object hashes to the index at the provided filenames -+func (repo *Repository) AddObjectsToIndex(objects ...IndexObjectInfo) error { -+ cmd := NewCommand(repo.Ctx, "update-index", "--add", "--replace", "-z", "--index-info") -+ stdout := new(bytes.Buffer) -+ stderr := new(bytes.Buffer) -+ buffer := new(bytes.Buffer) -+ for _, object := range objects { -+ // using format: mode SP type SP sha1 TAB path -+ buffer.WriteString(object.Mode + " blob " + object.Object.String() + "\t" + object.Filename + "\000") -+ } -+ return cmd.Run(&RunOpts{ -+ Dir: repo.Path, -+ Stdin: bytes.NewReader(buffer.Bytes()), -+ Stdout: stdout, -+ Stderr: stderr, -+ }) -+} -+ - // AddObjectToIndex adds the provided object hash to the index at the provided filename - func (repo *Repository) AddObjectToIndex(mode string, object ObjectID, filename string) error { -- cmd := NewCommand(repo.Ctx, "update-index", "--add", "--replace", "--cacheinfo").AddDynamicArguments(mode, object.String(), filename) -- _, _, err := cmd.RunStdString(&RunOpts{Dir: repo.Path}) -- return err -+ return repo.AddObjectsToIndex(IndexObjectInfo{Mode: mode, Object: object, Filename: filename}) - } - - // WriteTree writes the current index as a tree to the object db and returns its hash -diff --git a/services/pull/patch.go b/services/pull/patch.go -index 981bc989fca4a..e391a7f9d032a 100644 ---- a/services/pull/patch.go -+++ b/services/pull/patch.go -@@ -128,7 +128,7 @@ func (e *errMergeConflict) Error() string { - return fmt.Sprintf("conflict detected at: %s", e.filename) - } - --func attemptMerge(ctx context.Context, file *unmergedFile, tmpBasePath string, gitRepo *git.Repository) error { -+func attemptMerge(ctx context.Context, file *unmergedFile, tmpBasePath string, filesToRemove *[]string, filesToAdd *[]git.IndexObjectInfo) error { - log.Trace("Attempt to merge:\n%v", file) - - switch { -@@ -142,14 +142,13 @@ func attemptMerge(ctx context.Context, file *unmergedFile, tmpBasePath string, g - } - - // Not a genuine conflict and we can simply remove the file from the index -- return gitRepo.RemoveFilesFromIndex(file.stage1.path) -+ *filesToRemove = append(*filesToRemove, file.stage1.path) -+ return nil - case file.stage1 == nil && file.stage2 != nil && (file.stage3 == nil || file.stage2.SameAs(file.stage3)): - // 2. Added in ours but not in theirs or identical in both - // - // Not a genuine conflict just add to the index -- if err := gitRepo.AddObjectToIndex(file.stage2.mode, git.MustIDFromString(file.stage2.sha), file.stage2.path); err != nil { -- return err -- } -+ *filesToAdd = append(*filesToAdd, git.IndexObjectInfo{Mode: file.stage2.mode, Object: git.MustIDFromString(file.stage2.sha), Filename: file.stage2.path}) - return nil - case file.stage1 == nil && file.stage2 != nil && file.stage3 != nil && file.stage2.sha == file.stage3.sha && file.stage2.mode != file.stage3.mode: - // 3. Added in both with the same sha but the modes are different -@@ -160,7 +159,8 @@ func attemptMerge(ctx context.Context, file *unmergedFile, tmpBasePath string, g - // 4. Added in theirs but not ours: - // - // Not a genuine conflict just add to the index -- return gitRepo.AddObjectToIndex(file.stage3.mode, git.MustIDFromString(file.stage3.sha), file.stage3.path) -+ *filesToAdd = append(*filesToAdd, git.IndexObjectInfo{Mode: file.stage3.mode, Object: git.MustIDFromString(file.stage3.sha), Filename: file.stage3.path}) -+ return nil - case file.stage1 == nil: - // 5. Created by new in both - // -@@ -221,7 +221,8 @@ func attemptMerge(ctx context.Context, file *unmergedFile, tmpBasePath string, g - return err - } - hash = strings.TrimSpace(hash) -- return gitRepo.AddObjectToIndex(file.stage2.mode, git.MustIDFromString(hash), file.stage2.path) -+ *filesToAdd = append(*filesToAdd, git.IndexObjectInfo{Mode: file.stage2.mode, Object: git.MustIDFromString(hash), Filename: file.stage2.path}) -+ return nil - default: - if file.stage1 != nil { - return &errMergeConflict{file.stage1.path} -@@ -245,6 +246,9 @@ func AttemptThreeWayMerge(ctx context.Context, gitPath string, gitRepo *git.Repo - return false, nil, fmt.Errorf("unable to run read-tree -m! Error: %w", err) - } - -+ var filesToRemove []string -+ var filesToAdd []git.IndexObjectInfo -+ - // Then we use git ls-files -u to list the unmerged files and collate the triples in unmergedfiles - unmerged := make(chan *unmergedFile) - go unmergedFiles(ctx, gitPath, unmerged) -@@ -270,7 +274,7 @@ func AttemptThreeWayMerge(ctx context.Context, gitPath string, gitRepo *git.Repo - } - - // OK now we have the unmerged file triplet attempt to merge it -- if err := attemptMerge(ctx, file, gitPath, gitRepo); err != nil { -+ if err := attemptMerge(ctx, file, gitPath, &filesToRemove, &filesToAdd); err != nil { - if conflictErr, ok := err.(*errMergeConflict); ok { - log.Trace("Conflict: %s in %s", conflictErr.filename, description) - conflict = true -@@ -283,6 +287,15 @@ func AttemptThreeWayMerge(ctx context.Context, gitPath string, gitRepo *git.Repo - return false, nil, err - } - } -+ -+ // Add and remove files in one command, as this is slow with many files otherwise -+ if err := gitRepo.RemoveFilesFromIndex(filesToRemove...); err != nil { -+ return false, nil, err -+ } -+ if err := gitRepo.AddObjectsToIndex(filesToAdd...); err != nil { -+ return false, nil, err -+ } -+ - return conflict, conflictedFiles, nil - } -