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

fix: use --keep-cr option for git am #254

Merged
merged 1 commit into from
Mar 24, 2023
Merged

fix: use --keep-cr option for git am #254

merged 1 commit into from
Mar 24, 2023

Conversation

dsanders11
Copy link
Member

If the file being patched has CRLF line endings, git am will fail to apply an otherwise good patch. That's what causes the backport to 24-x-y on electron/electron#37603 to fail.

This change refs script/lib/git.py in e/e where the --keep-cr option is enabled by default with the usage of git am for applying patches there, for this same reason:

# Keep the CR of CRLF in case any patches target files with Windows line
# endings.
args += ['--keep-cr']

For reference, here are the logs for the failed backport on that PR:

backportImpl: Fetching squash commit details
backportImpl: Got squash commit details
backportImpl: Checking out target: "target_repo/24-x-y" to temp: "trop/24-x-y-bp-docs-change-msdn-links-to-new-microsoft-docs-1679680976297"
backportCommitsToBranch: Backporting 1 commits to 24-x-y
backportCommitsToBranch: The provided temporary branch name "trop/24-x-y-bp-docs-change-msdn-links-to-new-microsoft-docs-1679680976297" already exists, deleting existing ref before backporting
backportCommitsToBranch: Failed to apply patch to 24-x-y,Error: Applying: docs: change MSDN links to new Microsoft docs
Using index info to reconstruct a base tree...
M	docs/api/browser-window.md
M	docs/api/native-image.md
Patch failed at 0001 docs: change MSDN links to new Microsoft docs
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
error: patch failed: docs/fiddles/menus/customize-menus/index.html:70
error: docs/fiddles/menus/customize-menus/index.html: patch does not apply
error: Did you hand edit your patch?
It does not apply to blobs recorded in its index.
hint: Use 'git am --show-current-patch' to see the failed patch
backportImpl: Cherry picking commits to branch failed
Error: Cherry picking commit(s) to branch failed
    at Queue_1.default.enterQueue.annotations (/app/lib/utils.js:344:19)
removeLabel: Removing target/24-x-y from PR #37603

@dsanders11 dsanders11 requested a review from a team as a code owner March 24, 2023 19:18
Copy link
Member

@VerteDinde VerteDinde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants