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

Allow empty patch in git apply #996

Merged
merged 1 commit into from
Jun 25, 2024
Merged

Conversation

guineveresaenger
Copy link
Contributor

Fixes #991.

Previously, #983 attempted to fix this behavior; however, the --allow-empty was erroneously appended to the git am command, not the git apply command, as it should have been.

Git documentation for git apply --allow-empty is the behavior we want.

@guineveresaenger guineveresaenger requested a review from a team June 25, 2024 18:13
Copy link
Member

@iwahbe iwahbe left a comment

Choose a reason for hiding this comment

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

Please confirm that this works as expected by manually testing make upstream upstream.rebase upstream.finalize before merging.

LGTM

@guineveresaenger
Copy link
Contributor Author

Locally changed in pulumi-gcp:

apply() {
  assert_upstream
  assert_no_rebase_in_progress "$1"

  git submodule update --force --init
  # Iterating over the patches folder in sorted order,
  # apply the patch using a 3-way merge strategy. This mirrors the default behavior of 'git merge'
  cd upstream
  for patch in ../patches/*.patch; do
    if ! git apply --3way "$patch" --allow-empty; then
      cat <<EOF

make upstream

guin(master *) pulumi/pulumi-gcp🦉 make upstream     
scripts/upstream.sh "upstream" apply
Submodule path 'upstream': checked out '580cd0c10bc9d6334da3c248f4a3b0a897c8f57a'
Applied patch to 'google-beta/provider/provider.go' cleanly.
Applied patch to 'google-beta/services/sql/resource_sql_database_instance.go' cleanly.
[...]
warning: 3 lines add whitespace errors.
Applied patch to 'google-beta/services/storage/resource_storage_bucket.go' cleanly.
Applied patch to 'google-beta/tpgresource/labels.go' cleanly.

make upstream.rebase

guin(master *) pulumi/pulumi-gcp🦉 make upstream.rebase
scripts/upstream.sh "upstream.rebase" start_rebase
Submodule path 'upstream': checked out '580cd0c10bc9d6334da3c248f4a3b0a897c8f57a'
Rebasing in place at 580cd0c10bc9d6334da3c248f4a3b0a897c8f57a
Switched to and reset branch 'pulumi-patch'
Your branch is up to date with 'local'.
branch 'pulumi-patch' set up to track 'local'.
Applying ../patches/0001-Allow-disabling-the-partner-name.patch
[...]
Applying: fix label imports
Current branch pulumi-patch is up to date.

The full patch set has been cleanly applied to the './upstream' repository.
To "edit" the patch set, commit changes directly to './upstream'. When
you are done making changes, run:

    make upstream.finalize

to finish the rebase and commit those changes into the patch set.

make upstream.finalize

guin(master *%) pulumi/pulumi-gcp🦉 make upstream.finalize
scripts/upstream.sh "upstream.finalize" end_rebase
../patches/0001-Allow-disabling-the-partner-name.patch
../patches/0002-Add-nil-checks-for-sql-database-instance-flattening.patch
../patches/0003-rebase-bigquery_dataset.patch
../patches/0004-Add-flattening-of-self-managed-certificates.patch
../patches/0005-website-docs-d-tweaks.patch
../patches/0006-docs-patching.patch

../patches/0007-Exclude-scripts-dir-from-provider-go-module.patch
../patches/0008-Remove-duplicative-resource-token.patch
../patches/0009-Fix-794-with-an-unconditional-read.patch
../patches/0010-Remove-pattern-string-from-compute-forwarding-rules.patch
../patches/0011-fix-label-imports.patch
Submodule path 'upstream': checked out '580cd0c10bc9d6334da3c248f4a3b0a897c8f57a'
Applied patch to 'google-beta/provider/provider.go' cleanly.
[...]
Applied patch to 'google-beta/provider/provider.go' cleanly.
Applied patch to 'google-beta/services/sql/resource_sql_database_instance.go' cleanly.
../patches/0010-Remove-pattern-string-from-compute-forwarding-rules.patch:16: trailing whitespace.
  
../patches/0010-Remove-pattern-string-from-compute-forwarding-rules.patch:25: trailing whitespace.
  
../patches/0010-Remove-pattern-string-from-compute-forwarding-rules.patch:38: trailing whitespace.
  
Applied patch to 'website/docs/r/compute_forwarding_rule.html.markdown' cleanly.
Applied patch to 'website/docs/r/compute_global_forwarding_rule.html.markdown' cleanly.
warning: 3 lines add whitespace errors.
Applied patch to 'google-beta/services/storage/resource_storage_bucket.go' cleanly.
Applied patch to 'google-beta/tpgresource/labels.go' cleanly.
guin(master *) pulumi/pulumi-gcp🦉 git status
On branch master
Your branch is behind 'origin/master' by 4 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   patches/0001-Allow-disabling-the-partner-name.patch
        modified:   patches/0002-Add-nil-checks-for-sql-database-instance-flattening.patch
        modified:   patches/0006-docs-patching.patch
        modified:   patches/0008-Remove-duplicative-resource-token.patch
        modified:   patches/0009-Fix-794-with-an-unconditional-read.patch
        modified:   patches/0011-fix-label-imports.patch
        modified:   scripts/upstream.sh

no changes added to commit (use "git add" and/or "git commit -a")

@guineveresaenger guineveresaenger enabled auto-merge (squash) June 25, 2024 19:17
guineveresaenger added a commit that referenced this pull request Jun 25, 2024
#993 refactored the Required "Run actionlint and shellcheck" job,
limiting it to top-level `.github` paths.
This caused #995 and #996 to hang indefinitely.

This pull request re-enables this check to run on every pull request.
@guineveresaenger guineveresaenger force-pushed the guin/allow-empty-in-apply branch from dd4249b to 40903f0 Compare June 25, 2024 20:02
@guineveresaenger guineveresaenger enabled auto-merge (squash) June 25, 2024 20:02
@guineveresaenger guineveresaenger merged commit 0105f1d into master Jun 25, 2024
5 checks passed
@guineveresaenger guineveresaenger deleted the guin/allow-empty-in-apply branch June 25, 2024 20:03
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.

upgrade.sh: Allow for unpatched submodule
2 participants