30
30
import org .eclipse .jgit .revwalk .RevWalk ;
31
31
import org .eclipse .jgit .transport .UsernamePasswordCredentialsProvider ;
32
32
import org .eclipse .jgit .treewalk .TreeWalk ;
33
- import org .kohsuke .github .GHRef ;
34
- import org .kohsuke .github .GHRepository ;
35
33
import org .slf4j .Logger ;
36
34
import org .slf4j .LoggerFactory ;
37
35
38
36
import com .google .common .base .Strings ;
39
37
40
- import eu .solven .cleanthat .code_provider .github .code_provider .AGithubCodeProvider ;
41
38
import eu .solven .cleanthat .codeprovider .DummyCodeProviderFile ;
42
39
import eu .solven .cleanthat .codeprovider .ICodeProvider ;
43
40
import eu .solven .cleanthat .codeprovider .ICodeProviderFile ;
49
46
* @author Benoit Lacelle
50
47
*/
51
48
@ SuppressWarnings ("PMD.GodClass" )
52
- public class JGitCodeProvider extends AGithubCodeProvider implements ICodeProviderWriter {
49
+ public class JGitCodeProvider implements ICodeProviderWriter {
53
50
54
51
private static final Logger LOGGER = LoggerFactory .getLogger (JGitCodeProvider .class );
55
52
@@ -154,24 +151,6 @@ private static TreeWalk buildTreeWalk(Repository repository, RevTree tree, final
154
151
return treeWalk ;
155
152
}
156
153
157
- // @Override
158
- // public boolean deprecatedFileIsRemoved(Object file) {
159
- // String relativePath = (String) file;
160
- // Path path = workingDir.resolve(relativePath);
161
- //
162
- // if (!path.startsWith(workingDir)) {
163
- // // https://stackoverflow.com/questions/53157337/validate-to-prevent-a-path-string-to-go-up-to-parent-folder
164
- // throw new IllegalArgumentException("Can not move out of the parent folder");
165
- // }
166
- //
167
- // return !path.toFile().exists();
168
- // }
169
-
170
- public static String loadContent (GHRepository repository , GHRef ref , String filename ) throws IOException {
171
- String sha1 = ref .getObject ().getSha ();
172
- return loadContent (repository , filename , sha1 );
173
- }
174
-
175
154
@ Override
176
155
public String getHtmlUrl () {
177
156
try {
@@ -189,13 +168,9 @@ public String getTitle() {
189
168
@ Override
190
169
public void persistChanges (Map <String , String > pathToMutatedContent ,
191
170
List <String > prComments ,
192
- Collection <String > prLabels
193
- // , Optional<String> targetBranch
194
- ) {
195
- // targetBranch
196
-
171
+ Collection <String > prLabels ) {
197
172
pathToMutatedContent .forEach ((k , v ) -> {
198
- Path resolvedPath = workingDir .resolve (( String ) k );
173
+ Path resolvedPath = workingDir .resolve (k );
199
174
200
175
try {
201
176
Files .writeString (resolvedPath , v , StandardOpenOption .TRUNCATE_EXISTING );
0 commit comments