diffplug / diffplug/spotless

`ratchetFrom` doesn't support merge conflicts

Aperta
#1,504 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
Java
Stelle
5.6k
Fork
559
Merge medio
1g 14h
PR unite (30g)
43

Descrizione

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 ..." 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 ..." to update what will be committed)
(use "git restore ..." 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).

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Reproduce the merge-conflict state shown by `git status`, with the deleted `java/src/test/java/eu/solven/cleanthat/language/java/rules/test/ATestCases.java` and modified `ARefactorerCases.java`, then inspect how the Maven plugin handles `ratchetFrom` set to `origin/main`. Run the Spotless Maven apply goal and verify that formatting no longer attempts to read the deleted path.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
git, java
Ambito
build-system, tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.