| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4a9cfa9 commit 90f88a6
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -151,21 +151,28 @@ describe("Clone", function() { | |||
| 151 | 151 | }); | |
| 152 | 152 | }); | |
| 153 | 153 | ||
| 154 | - it("will not segfault when accessing a url without username", function() { | ||
| 154 | + it.only("will not segfault when accessing a url without username", function(){ | ||
| 155 | 155 | var url = "https://github.com/nodegit/private"; | |
| 156 | 156 | ||
| 157 | + var firstPass = true; | ||
| 158 | + | ||
| 157 | 159 | return Clone(url, clonePath, { | |
| 158 | 160 | fetchOpts: { | |
| 159 | 161 | callbacks: { | |
| 160 | 162 | certificateCheck: function() { | |
| 161 | 163 | return 1; | |
| 162 | 164 | }, | |
| 163 | 165 | credentials: function() { | |
| 164 | - return NodeGit.Cred.userpassPlaintextNew("fake-token", | ||
| 165 | - "x-oauth-basic"); | ||
| 166 | + if (firstPass) { | ||
| 167 | + firstPass = false; | ||
| 168 | + return NodeGit.Cred.userpassPlaintextNew("fake-token", | ||
| 169 | + "x-oauth-basic"); | ||
| 170 | + } else { | ||
| 171 | + return NodeGit.Cred.defaultNew(); | ||
| 172 | + } | ||
| 166 | 173 | } | |
| 167 | 174 | } | |
| 168 | 175 | } | |
| 169 | - }).catch(function unhandledError() { }); | ||
| 176 | + }).catch(function(reason) { }); | ||
| 170 | 177 | }); | |
| 171 | 178 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -194,13 +194,16 @@ describe("Remote", function() { | |||
| 194 | 194 | var firstPass = true; | |
| 195 | 195 | var options = { | |
| 196 | 196 | callbacks: { | |
| 197 | - credentials:function(url, userName) { | ||
| 197 | + credentials: function(url, userName) { | ||
| 198 | 198 | if (firstPass) { | |
| 199 | + firstPass = false; | ||
| 199 | 200 | if (url.indexOf("https") === -1) { | |
| 200 | 201 | return NodeGit.Cred.sshKeyFromAgent(userName); | |
| 201 | 202 | } else { | |
| 202 | - return NodeGit.Cred.defaultNew(); | ||
| 203 | + return NodeGit.Cred.userpassPlaintextNew(userName, ""); | ||
| 203 | 204 | } | |
| 205 | + } else { | ||
| 206 | + return NodeGit.Cred.defaultNew(); | ||
| 204 | 207 | } | |
| 205 | 208 | }, | |
| 206 | 209 | certificateCheck: function() { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments