Skip to content

Commit bd9b92a

Browse files
committed
Apply some IDE suggestions
1 parent 2db26cd commit bd9b92a

File tree

4 files changed

+8
-15
lines changed

4 files changed

+8
-15
lines changed

src/main/java/org/dstadler/jgit/porcelain/FetchRemoteCommitsWithSshAuth.java

-6
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22

33
import com.jcraft.jsch.JSch;
44
import com.jcraft.jsch.JSchException;
5-
import com.jcraft.jsch.Session;
65
import org.eclipse.jgit.api.Git;
76
import org.eclipse.jgit.api.LsRemoteCommand;
87
import org.eclipse.jgit.api.errors.GitAPIException;
98
import org.eclipse.jgit.lib.Ref;
109
import org.eclipse.jgit.transport.SshSessionFactory;
1110
import org.eclipse.jgit.transport.SshTransport;
1211
import org.eclipse.jgit.transport.ssh.jsch.JschConfigSessionFactory;
13-
import org.eclipse.jgit.transport.ssh.jsch.OpenSshConfig;
1412
import org.eclipse.jgit.util.FS;
1513

1614
import java.util.Map;
@@ -32,10 +30,6 @@ public class FetchRemoteCommitsWithSshAuth {
3230
public static void main(String[] args) throws GitAPIException {
3331

3432
final SshSessionFactory sshSessionFactory = new JschConfigSessionFactory() {
35-
@Override
36-
protected void configure(OpenSshConfig.Host host, Session session) {
37-
}
38-
3933
@Override
4034
protected JSch createDefaultJSch(FS fs) throws JSchException {
4135
JSch defaultJSch = super.createDefaultJSch(fs);

src/main/java/org/dstadler/jgit/porcelain/PushToRemoteRepository.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
import java.io.File;
2929
import java.io.IOException;
30-
import java.nio.charset.StandardCharsets;
3130
import java.nio.file.Files;
3231

3332

@@ -95,7 +94,7 @@ public static void main(String[] args) throws IOException, GitAPIException {
9594
private static void createCommit(Repository repository, Git git, String fileName, String content) throws IOException, GitAPIException {
9695
// create the file
9796
File myFile = new File(repository.getDirectory().getParent(), fileName);
98-
Files.write(myFile.toPath(), content.getBytes(StandardCharsets.UTF_8));
97+
Files.writeString(myFile.toPath(), content);
9998

10099
// run the add
101100
git.add()

src/main/java/org/dstadler/jgit/porcelain/RevertChanges.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static void main(String[] args) throws IOException, GitAPIException {
4141

4242
// write some initial text to it
4343
String initialText = "Initial Text";
44-
System.out.println("Writing text [" + initialText + "] to file [" + tempFile.toString() + "]");
44+
System.out.println("Writing text [" + initialText + "] to file [" + tempFile + "]");
4545
Files.write(tempFilePath, initialText.getBytes());
4646

4747
// add the file and commit it

src/main/java/org/dstadler/jgit/unfinished/UpdateIndex.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@
1616
limitations under the License.
1717
*/
1818

19-
import java.io.File;
20-
import java.io.IOException;
21-
import java.util.Date;
22-
import java.util.Set;
23-
2419
import org.apache.commons.io.FileUtils;
2520
import org.dstadler.jgit.helper.CookbookHelper;
2621
import org.eclipse.jgit.api.Git;
@@ -33,6 +28,11 @@
3328
import org.eclipse.jgit.errors.NoWorkTreeException;
3429
import org.eclipse.jgit.lib.Repository;
3530

31+
import java.io.File;
32+
import java.io.IOException;
33+
import java.util.Date;
34+
import java.util.Set;
35+
3636
/**
3737
* Note: This snippet is not done and likely does not show anything useful yet
3838
*
@@ -78,7 +78,7 @@ private static class AssumeChangedCommand extends GitCommand<String> {
7878
}
7979

8080
@Override
81-
public String call() throws GitAPIException {
81+
public String call() {
8282
try {
8383
DirCache index = repo.lockDirCache();
8484
DirCacheEntry entry = index.getEntry(fileName);

0 commit comments

Comments
 (0)