[GitHub] incubator-netbeans pull request #25: NETBEANS-73: Autodetect id_rsa and id_d...

2017-10-03 Thread lkishalmi
Github user lkishalmi closed the pull request at:

https://github.com/apache/incubator-netbeans/pull/25


---


[GitHub] incubator-netbeans pull request #25: NETBEANS-73: Autodetect id_rsa and id_d...

2017-09-30 Thread lkishalmi
Github user lkishalmi commented on a diff in the pull request:

https://github.com/apache/incubator-netbeans/pull/25#discussion_r142020017
  
--- Diff: 
git/src/org/netbeans/modules/git/ui/repository/remote/RemoteRepository.java ---
@@ -686,6 +686,7 @@ public SSHConnectionSettingsType () {
 settingsPanel.savePasswordCheckBox
 };
 acceptableSchemes = EnumSet.of(Scheme.SSH, Scheme.SFTP);
+
settingsPanel.txtIdentityFile.setText(getDefaultIdentityFilePath());
--- End diff --

Unfortunately populateFields is not called in every case. Most importantly 
when the repository URL is being copied from github/gitlab where the ssh:// 
prefix is just missing from the URL. Probably I could raise a bug on that. And 
mark this line as a workaround in the code, till it gets fixed. I feel the fix 
would be a bit out of the trivial category.


---


[GitHub] incubator-netbeans pull request #25: NETBEANS-73: Autodetect id_rsa and id_d...

2017-09-30 Thread emilianbold
Github user emilianbold commented on a diff in the pull request:

https://github.com/apache/incubator-netbeans/pull/25#discussion_r141999246
  
--- Diff: 
git/src/org/netbeans/modules/git/ui/repository/remote/RemoteRepository.java ---
@@ -686,6 +686,7 @@ public SSHConnectionSettingsType () {
 settingsPanel.savePasswordCheckBox
 };
 acceptableSchemes = EnumSet.of(Scheme.SSH, Scheme.SFTP);
+
settingsPanel.txtIdentityFile.setText(getDefaultIdentityFilePath());
--- End diff --

This line does not seem necessary. 
`SSHConnectionSettingsType.populateFields` does call

```java
String identityFile = getDefaultIdentityFilePath();
settingsPanel.txtIdentityFile.setText(identityFile);
```


---


[GitHub] incubator-netbeans pull request #25: NETBEANS-73: Autodetect id_rsa and id_d...

2017-09-30 Thread emilianbold
Github user emilianbold commented on a diff in the pull request:

https://github.com/apache/incubator-netbeans/pull/25#discussion_r141999265
  
--- Diff: 
git/src/org/netbeans/modules/git/ui/repository/remote/RemoteRepository.java ---
@@ -853,9 +854,13 @@ protected int getPreferedPanelHeight () {
 
 private String getDefaultIdentityFilePath () {
 String identityFile = ""; //NOI18N
-if (!Utilities.isWindows()) {
-identityFile = System.getProperty("user.home") + 
File.separator //NOI18N
-+ ".ssh" + File.separator + "id_dsa"; //NOI18N
+File sshDir = new File(System.getProperty("user.home"), 
".ssh"); //NOI18N
+File rsaKey = new File(sshDir, "id_rsa"); //NOI18N
+File dsaKey = new File(sshDir, "id_dsa"); //NOI18N
+if (rsaKey.canRead()) {
+identityFile = rsaKey.getAbsolutePath();
+} else if (dsaKey.canRead()) {
+identityFile = dsaKey.getAbsolutePath();
--- End diff --

This looks OK.


---


[GitHub] incubator-netbeans pull request #25: NETBEANS-73: Autodetect id_rsa and id_d...

2017-09-29 Thread lkishalmi
GitHub user lkishalmi opened a pull request:

https://github.com/apache/incubator-netbeans/pull/25

NETBEANS-73: Autodetect id_rsa and id_dsa keys for Git private key.

Simple patch for https://issues.apache.org/jira/browse/NETBEANS-73

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/lkishalmi/incubator-netbeans 
NETBEANS-73_Git_Private_Key_Improvement

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-netbeans/pull/25.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #25


commit 5c1ea668924c481e0d24c82c9fbcd5158e055780
Author: Laszlo Kishalmi 
Date:   2017-09-29T22:03:39Z

NETBEANS-73: Autodetect id_rsa and id_dsa keys for Git private key.




---