Skip to content

Switching away from a pull request leaves its ignored files behind as changes on trunk #521

Closed

Description

@juanmaguitar

On a Gutenberg site, check out WordPress/gutenberg#76292 (Font Library: Gracefully handle Chrome OTS font rejection during browser preview), a March PR. Its tree still has packages/react-native-editor/, and install/build generate i18n-cache/data/*.json and index.native.js there. The PR's own nested .gitignore files ignore them. Switch back to trunk: trunk no longer has that package, so the .gitignore files go but the generated files stay. Trunk then shows 10 changes the contributor never made. Switching away is refused as dirty trunk, or linking a ticket carries the files into it.

Expected: files that were ignored before a switch are not counted as the contributor's changes after it. Nothing is deleted.

Proposed fix: only when the .gitignore files differ between the two trees (a cheap tree diff, so normal switches cost nothing), list what is ignored before the checkout. After it, add the paths that became untracked to an app-owned block in .git/info/exclude, the mechanism #19 introduced.

Seen on v1.2.0-beta.2, macOS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions