Skip to content

Commit 2953560

Browse files
committed
Now we don't need anything except CachedEndings to be Serializable.
1 parent aab35d5 commit 2953560

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

lib-extra/src/main/java/com/diffplug/spotless/extra/GitAttributesLineEndings.java

+5-20
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import java.util.Set;
3535
import java.util.function.Supplier;
3636
import java.util.stream.Collectors;
37-
import java.util.stream.Stream;
3837

3938
import javax.annotation.Nullable;
4039

@@ -134,24 +133,18 @@ public String endingFor(File file) {
134133
}
135134
}
136135

137-
@SuppressFBWarnings("SE_TRANSIENT_FIELD_NOT_RESTORED")
138-
static class FileState implements Serializable {
139-
private static final long serialVersionUID = 1L;
140-
136+
static class FileState {
141137
/** /etc/gitconfig (system-global), ~/.gitconfig, project/.git/config (each might-not exist). */
142-
transient final FileBasedConfig systemConfig, userConfig, repoConfig;
138+
final FileBasedConfig systemConfig, userConfig, repoConfig;
143139

144140
/** Global .gitattributes file pointed at by systemConfig or userConfig, and the file in the repo. */
145-
transient final @Nullable File globalAttributesFile, repoAttributesFile;
141+
final @Nullable File globalAttributesFile, repoAttributesFile;
146142

147143
/** git worktree root, might not exist if we're not in a git repo. */
148-
transient final @Nullable File workTree;
144+
final @Nullable File workTree;
149145

150146
/** All the .gitattributes files in the work tree that we're formatting. */
151-
transient final List<File> gitattributes;
152-
153-
/** The signature of *all* of the files below. */
154-
final FileSignature signature;
147+
final List<File> gitattributes;
155148

156149
@SuppressFBWarnings("SIC_INNER_SHOULD_BE_STATIC_ANON")
157150
FileState(File projectDir, Iterable<File> toFormat) throws IOException {
@@ -208,14 +201,6 @@ public boolean isOutdated() {
208201

209202
// The .gitattributes files which apply to the files we are formatting
210203
gitattributes = gitAttributes(toFormat);
211-
212-
// find every actual File which exists above
213-
Stream<File> misc = Stream.of(systemConfig.getFile(), userConfig.getFile(), repoConfig.getFile(), globalAttributesFile, repoAttributesFile);
214-
List<File> toSign = Stream.concat(gitattributes.stream(), misc)
215-
.filter(file -> file != null && file.exists() && file.isFile())
216-
.collect(Collectors.toList());
217-
// sign it for up-to-date checking
218-
signature = FileSignature.signAsSet(toSign);
219204
}
220205

221206
/** Returns all of the .gitattributes files which affect the given files. */

0 commit comments

Comments
 (0)