Skip to content

ratchetFrom doesn't support merge conflicts #1504

Open
@blacelle

Description

@blacelle

This is an edge case.

I consider a local repository, during a merge conflict. I end with some files being removed locally, but in conflict with the remote head: during the conflict-management process, I end with something like:


cleanthat git status
On branch IntroduceSpotLess
Your branch is up to date with 'origin/IntroduceSpotLess'.

You have unmerged paths.
  (fix conflicts and run "git commit")
  (use "git merge --abort" to abort the merge)

Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)
	deleted by us:   java/src/test/java/eu/solven/cleanthat/language/java/rules/test/ATestCases.java

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:   java/src/test/java/eu/solven/cleanthat/language/java/refactorer/test/ARefactorerCases.java
	modified:   java/src/test/java/eu/solven/cleanthat/language/java/refactorer/test/ATestCases.java

Here, I'm moving java/src/test/java/eu/solven/cleanthat/language/java/rules/test/ATestCases.java into java/src/test/java/eu/solven/cleanthat/language/java/refactorer/test/ARefactorerCases.java

I end with an issue like:

[ERROR] Failed to execute goal com.diffplug.spotless:spotless-maven-plugin:2.30.0:apply (applySpotless) on project java: Unable to format file /Users/blacelle/workspace3/cleanthat/java/src/test/java/eu/solven/cleanthat/language/java/rules/test/ATestCases.java -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.diffplug.spotless:spotless-maven-plugin:2.30.0:apply (applySpotless) on project java: Unable to format file /Users/blacelle/workspace3/cleanthat/java/src/test/java/eu/solven/cleanthat/language/java/rules/test/ATestCases.java
...
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to format file /Users/blacelle/workspace3/cleanthat/java/src/test/java/eu/solven/cleanthat/language/java/rules/test/ATestCases.java
    at com.diffplug.spotless.maven.SpotlessApplyMojo.process (SpotlessApplyMojo.java:51)
    at com.diffplug.spotless.maven.AbstractSpotlessMojo.execute (AbstractSpotlessMojo.java:214)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
...
Caused by: java.nio.file.NoSuchFileException: /Users/blacelle/workspace3/cleanthat/java/src/test/java/eu/solven/cleanthat/language/java/rules/test/ATestCases.java
    at sun.nio.fs.UnixException.translateToIOException (UnixException.java:92)
    at sun.nio.fs.UnixException.rethrowAsIOException (UnixException.java:111)
    at sun.nio.fs.UnixException.rethrowAsIOException (UnixException.java:116)
    at sun.nio.fs.UnixFileSystemProvider.newByteChannel (UnixFileSystemProvider.java:219)
    at java.nio.file.Files.newByteChannel (Files.java:370)
    at java.nio.file.Files.newByteChannel (Files.java:421)
    at java.nio.file.Files.readAllBytes (Files.java:3205)
    at com.diffplug.spotless.PaddedCell.calculateDirtyState (PaddedCell.java:189)
    at com.diffplug.spotless.maven.SpotlessApplyMojo.process (SpotlessApplyMojo.java:45)
    at com.diffplug.spotless.maven.AbstractSpotlessMojo.execute (AbstractSpotlessMojo.java:214)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
...

where we try to clean a file whicle it does not exists.

I suppose it relates with the ratchetFrom feature (which is set to origin/main in my configuration).

Activity

changed the title [-]java.nio.file.NoSuchFileException on spotlessApply if repository is merging conflicts[/-] [+]`ratchetFrom` doesn't support merge conflicts[/+] on Jan 19, 2023
nedtwigg

nedtwigg commented on Jan 19, 2023

@nedtwigg
Member

Fixing this will probably be related to #911

blacelle

blacelle commented on Mar 10, 2023

@blacelle
ContributorAuthor

Also relates with #623

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @blacelle@nedtwigg

        Issue actions

          `ratchetFrom` doesn't support merge conflicts · Issue #1504 · diffplug/spotless