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

[ArPow] Use --work-tree with git apply #4254

Merged
merged 1 commit into from
Sep 10, 2021

Conversation

omajid
Copy link
Contributor

@omajid omajid commented Sep 9, 2021

Bug

Fixes: NuGet/Home#11227

Regression? Last working version: Not a really a regression in NuGet.Client, though it is a regression from source-build 5.0.

Description

See the issue for details about the problem and how to reproduce.

Use git --work-tree=path apply to ensure that git apply works even if the sources are copied somewhere else or the .git directory is removed and the code just happens to be placed somewhere under a git repository.

This is the same fix that's used everywhere else within ArPow: https://github.com/dotnet/installer/blob/74507010fafeb931a063f8649bff0b032ebc725b/src/SourceBuild/tarball/content/repos/Directory.Build.targets#L83

PR Checklist

  • PR has a meaningful title

  • PR has a linked issue.

  • Described changes

  • Tests

    • Automated tests added
    • OR
    • Test exception: only reproduces with ArPow tarball build, and even that, when placed in a unrelated git repository
    • OR
    • N/A
  • Documentation

    • Documentation PR or issue filled
    • OR
    • N/A

This makes things work bettern in a source-tarball build (where there
may not be a .git directory), or there might be a .git directory but
it's for a different repo than the one we are building.
@omajid omajid requested a review from a team as a code owner September 9, 2021 15:56
@ghost ghost added the Community PRs created by someone not in the NuGet team label Sep 9, 2021
@omajid
Copy link
Contributor Author

omajid commented Sep 9, 2021

cc @dotnet/source-build-contrib

@omajid
Copy link
Contributor Author

omajid commented Sep 9, 2021

Hm... @dotnet/source-build-contrib isn't working?

cc @crummel @dseefeld @MichaelSimons @lbussell

@@ -55,7 +55,7 @@
</ItemGroup>

<Exec
Command="git apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
Command="git --work-tree=$(ProjectRoot) apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
Copy link
Contributor Author

@omajid omajid Sep 9, 2021

Choose a reason for hiding this comment

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

I used ProjectRoot based on the WorkingDirectory set on the next line; is there a better variable name I should be using instead?

Copy link

Choose a reason for hiding this comment

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

I think ProjectRoot is correct here.

Copy link
Contributor

@aortiz-msft aortiz-msft left a comment

Choose a reason for hiding this comment

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

Approved for insertion into dev branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community PRs created by someone not in the NuGet team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: ArPow build doesn't work well when in a subdirectory of an unrelated git repository
4 participants