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

Changing code-scope to file-scope commit broke PRs #16572

Closed
MikeAlhayek opened this issue Aug 15, 2024 · 24 comments
Closed

Changing code-scope to file-scope commit broke PRs #16572

MikeAlhayek opened this issue Aug 15, 2024 · 24 comments
Milestone

Comments

@MikeAlhayek
Copy link
Member

As expected merging merging #16539 broke all existing PRs

@MikeAlhayek
Copy link
Member Author

Here are the steps each PR author need to do to resolve the conflicts of their PR

# checkout PR
git checkout <BRANCH>

# merge the changes before the formatting was applied
git merge before-formatting

<FIX MERGE CONFLICTS IF ANY>

# commit changes (including resolved merge conflicts if any)
git commit -m "Merge tag 'before-formatting"

# patch formatting settings locally
curl https://gist.githubusercontent.com/sebastienros/b2e88eb460396e07c8bdeeb725645a22/raw/bf3b8854b9bfc13e68da94044dea77eee9623cd5/patchformatfiles.patch -o c:\temp\patchformatfiles.patch
git apply c:\temp\patchformatfiles.patch

# apply formatting
dotnet restore
dotnet format --severity info --diagnostics IDE0160 IDE0161

# commit formatting changes
git add -A
git commit -m "Format code"

# merge with official formatting branch
git merge formatting --no-edit --strategy-option ours

# ensure local code builds correctly
dotnet build

# push changes
git push

@hishamco
Copy link
Member

@MikeAlhayek I got the following error

curl : Could not find a part of the path 'C:\temp\patchformatfiles.patch'.

@MikeAlhayek
Copy link
Member Author

the curl command should download the remote file locally for you on C:\temp\patchformatfiles.patch. Try changing it to C:/temp/patchformatfiles.patch or any other local path to see if that works

@hishamco
Copy link
Member

Seem you forgot that temp inside windows folder

@hishamco
Copy link
Member

error: patch failed: .editorconfig:1
error: .editorconfig: patch does not apply
error: patch failed: .gitattributes:1
error: .gitattributes: patch does not apply
error: patch failed: Directory.Packages.props:56
error: Directory.Packages.props: patch does not apply
error: patch failed: src/OrchardCore.Build/OrchardCore.Commons.props:13
error: src/OrchardCore.Build/OrchardCore.Commons.props: patch does not apply

@MikeAlhayek
Copy link
Member Author

did you try to place it on a different location that C:/temp?

@hishamco
Copy link
Member

yes, the issue right now while executing git apply

@hishamco
Copy link
Member

I tried to use git apply --check seems there's an error somewhere

@hishamco
Copy link
Member

@sebastienros, do you have any idea how to resolve the above error? I need to resolve all the conflicts for my PRs?

@hishamco
Copy link
Member

@MikeAlhayek could you please reply ASAP I'm unable to update my PRs

@MikeAlhayek
Copy link
Member Author

Can you share the error you are experiencing? Others have reported no issues with this script

@hishamco
Copy link
Member

I already list the errors above

@MikeAlhayek
Copy link
Member Author

sorry not sure. maybe @sebastienros have some feedback on your error.

@hishamco
Copy link
Member

I'm waiting ..

@sebastienros
Copy link
Member

git apply -v C:/temp/patchformatfiles.patch to list the issues with this command.
Also please check that the content of this file is correct and matches the source on gist.

@hishamco
Copy link
Member

hishamco commented Aug 17, 2024

Checking patch .editorconfig...
error: while searching for:
root = true

[*]
end_of_line = crlf
charset = utf-8
indent_style = space
indent_size = 4

error: patch failed: .editorconfig:1
error: .editorconfig: patch does not apply
Checking patch .gitattributes...
error: while searching for:
* text=auto

**/wwwroot/Scripts/* linguist-vendored

# Keep LF line endings in webroot assets files. Otherwise, building them under Windows would change the line endings to CLRF and cause changes without actually editing the source files.
**/wwwroot/**/*.js text eol=lf
**/wwwroot/**/*.css text eol=lf

error: patch failed: .gitattributes:1
error: .gitattributes: patch does not apply
Checking patch Directory.Packages.props...
error: while searching for:
    <PackageVersion Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="8.0.1" />
    <PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
    <PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
    <PackageVersion Include="MimeKit" Version="4.7.1" />
    <PackageVersion Include="MiniProfiler.AspNetCore.Mvc" Version="4.3.8" />
    <PackageVersion Include="Moq" Version="4.20.70" />

error: patch failed: Directory.Packages.props:56
error: Directory.Packages.props: patch does not apply
Checking patch src/OrchardCore.Build/OrchardCore.Commons.props...
error: while searching for:
    <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
    <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
    <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>

    <!-- Common NuGet properties-->
    <OCFrameworkDescription>Orchard Core Framework is an application framework for building modular, multi-tenant applications on ASP.NET Core.</OCFrameworkDescription>
    <OCCMSDescription>Orchard Core CMS is a Web Content Management System (CMS) built on top of the Orchard Core Framework.</OCCMSDescription>

error: patch failed: src/OrchardCore.Build/OrchardCore.Commons.props:13
error: src/OrchardCore.Build/OrchardCore.Commons.props: patch does not apply

@hishamco
Copy link
Member

Also please check that the content of this file is correct and matches the source on gist.

It should be the same while the command read from your gist

@hyzx86
Copy link
Contributor

hyzx86 commented Aug 20, 2024

Hi @MikeAlhayek , Is this operation necessary? Or is it also possible to fix the conflict manually?

@MikeAlhayek
Copy link
Member Author

@hyzx86 it’s not required. You can fix them manually if the PR does not have much many file. We shared these steps to make it easier for PRs with many changes.

@hishamco
Copy link
Member

I'm still blocked by this, any idea?

@MikeAlhayek
Copy link
Member Author

I'm still blocked by this, any idea?

If there isn't many files, update them manually.

@hishamco
Copy link
Member

Some PRs have many files

@sebastienros sebastienros added this to the 2.x milestone Aug 29, 2024
Copy link
Contributor

We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues).

This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here.

@hishamco
Copy link
Member

Still, there's no update here

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

No branches or pull requests

4 participants