OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.36k stars 2.37k forks source link

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

Open MikeAlhayek opened 1 month ago

MikeAlhayek commented 1 month ago

As expected merging merging #16539 broke all existing PRs

MikeAlhayek commented 1 month ago

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 commented 1 month ago

@MikeAlhayek I got the following error

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

MikeAlhayek commented 1 month ago

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 commented 1 month ago

Seem you forgot that temp inside windows folder

hishamco commented 1 month ago

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 commented 1 month ago

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

hishamco commented 1 month ago

yes, the issue right now while executing git apply

hishamco commented 1 month ago

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

hishamco commented 1 month ago

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

hishamco commented 1 month ago

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

MikeAlhayek commented 1 month ago

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

hishamco commented 1 month ago

I already list the errors above

MikeAlhayek commented 1 month ago

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

hishamco commented 1 month ago

I'm waiting ..

sebastienros commented 4 weeks ago

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 commented 4 weeks ago
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 commented 4 weeks ago

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 commented 3 weeks ago

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

MikeAlhayek commented 3 weeks ago

@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 commented 3 weeks ago

I'm still blocked by this, any idea?

MikeAlhayek commented 3 weeks ago

I'm still blocked by this, any idea?

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

hishamco commented 3 weeks ago

Some PRs have many files

github-actions[bot] commented 2 weeks ago

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 commented 2 weeks ago

Still, there's no update here