Visitar URL original
[Bug]: files deleted in template not being removed in PR · Issue #551 · AndreasAugustin/actions-template-sync · GitHub
Skip to content

[Bug]: files deleted in template not being removed in PR #551

Closed

Description

@JessicaS11

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When a file is deleted in the template repository, the PR opened by the action does not delete the file in the current repo (I'm using "current repo" here to be the repo I'm currently working on that was created from the template and that I'd like to apply the template changes to).

Expected Behavior

I expected any file deleted in the parent repo to also be deleted after the action is run.

Current Behavior

The file removed from the template repo is not removed in the current repo, even with IS_FORCE_DELETION: true and GIT_REMOTE_PULL_PARAMS: --allow-unrelated-histories --squash --strategy=recursive -X theirs --no-edit. This is discussed in an open PR starting here. As noted there, I tried with multiple combinations of git_remote_pull_params to no avail.

Steps To Reproduce

To dig in further, I tried imitating what actions-template-sync does locally by adding the original template repo as an upstream to my current repo. I noticed that pulling using the same flags resulted in none of the deleted files being tracked.

Possible Solution

I ultimately tracked down this excellent explanation of how git handles merging with --allow-unrelated-histories, which as best as I can tell is likely the issue. One possible solution I found uses git replace --graft to create an artificial common history point.

git fetch upstream main
git replace --graft <ocal_current_git_hash> <a_hash_on_parent_before_used_template>
git merge --allow-unrelated-histories --squash --strategy=recursive -X theirs --no-edit --no-rebase

UPDATE (I found an error in which hash I used for the graft): This successfully identified the deleted files and a run of git status suggests at least all the right files have been touched. I'm not sure if this would be the preferred approach to addressing this bug (I'm already out of my usual depth in git), but if someone can help with designing the best approach I'll take a stab at implementing a solution.

Additional Information/Context

No response

Template sync version Version

2.2.3

Activity

  1. AndreasAugustin commented on Jul 23, 2024

    @AndreasAugustin
    Owner

    Hi @JessicaS11 and thanks for the bug report.
    I try to find some time to look into the issue ASAP

  2. JessicaS11 commented on Aug 1, 2024

    @JessicaS11
    Author

    Just wanted to add a note that we're going to port in the remainder of the changes manually for the repo linked above ("current behavior") because we need it for an event. But, we can use this one as an ongoing test case (it tracks the same template and is otherwise a scratch repo).

  3. AndreasAugustin commented on Aug 1, 2024

    @AndreasAugustin
    Owner

    @JessicaS11 thanks a lot for the sample.

  4. WolfGreyDev commented on Nov 6, 2024

    @WolfGreyDev

    I too am running into problems with IS_FORCE_DELETION: true not preforming the action while using the GIT_REMOTE_PULL_PARAMS recommended settings.

      ::info::force delete files
      ::warn::force file deletion is enabled. Deleting files which are deleted within the target repository
      ::info::current git hash: <git-hash>
      ::warn::files to delete: 
      ::endgroup::
    

    This suggests IS_FORCE_DELETION active but as you can see, no files are selected. I'm not sure if something is broken, or if the documentation isn't up to date with working settings.

  5. AndreasAugustin commented on Nov 11, 2024

    @AndreasAugustin
    Owner

    Hi @WolfGreyDev and thanks for the addon.
    Unfortunately I was not able yet to take a closer look. Hopefully will finish some other projects soon to get some more time available.

  6. added 3 commits that reference this issue on Jan 7, 2025
  7. AndreasAugustin commented on Jan 7, 2025

    @AndreasAugustin
    Owner

    Hi @JessicaS11 super sorry for the super long wait time. I was really busy with other tasks I needed to focus on (which actually are needed to pay my bills)
    The issue should be gone with next fix version v2.4.2.

    Some details within #596 .

    The issue was a bad refactoring mistake which has lead to a bad race condition.

  8. JessicaS11 commented on Jan 27, 2025

    @JessicaS11
    Author

    Thanks for the fix, @AndreasAugustin! I totally understand (darn those pesky bills!). I look forward to trying it out.

  9. AndreasAugustin commented on Jan 29, 2025

    @AndreasAugustin
    Owner

    @JessicaS11 thanks for the offer. Unfortunately it seems the issue is still not fixed for any reason. But I have an idea to finally solve the issue (and others coming with squashed commits).
    #596 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions