Skip to content

Commit

Permalink
should fix #493
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanlm committed Dec 7, 2017
1 parent 834e5e2 commit 0ddc038
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ cloneRepositoryFrom: aRemote branch: aBranchName
repo := LGitRepository on: self location.
cloneOptions := LGitCloneOptions withCredentialsProvider: IceCredentialsProvider default.
cloneOptions checkoutOptions checkoutStrategy: LGitCheckoutStrategyEnum git_checkout_none.
repo clone: url options: cloneOptions.
[ repo clone: url options: cloneOptions ]
on: LGit_GIT_ERROR
do: [ :e |
"sad that I need to do it like this :("
(e messageText beginsWith: 'error authenticating:')
ifTrue: [ e resignalAs: IceAuthenticationError new ] ].
repo checkout: (aBranchName ifNil: [
self branch
ifNotNil: [ :b | b name ]
Expand Down
1 change: 1 addition & 0 deletions Iceberg.package/IceAuthenticationError.class/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I indicate when an error trying to authenticate occurs (tipically, when cloning without credentials)
11 changes: 11 additions & 0 deletions Iceberg.package/IceAuthenticationError.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"commentStamp" : "<historical>",
"super" : "IceError",
"category" : "Iceberg-Errors",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "IceAuthenticationError",
"type" : "normal"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ getOrCreateIcebergRepository
^ IceRepository registry
detect: [ :repo | repo origin referencesSameRemoteLocationAs: remote ]
ifNone: [
(IceRepositoryCreator new
url: remoteUrl;
| urlToUse |
urlToUse := remote url.
[ (IceRepositoryCreator new
url: urlToUse;
subdirectory: repoPath;
branchName: self projectVersion;
createRepository)
register ]
register ]
on: IceAuthenticationError
do: [ :e |
self crLog: 'I got an error while cloning: {1}. I will try to clone the HTTPS variant.'.
urlToUse := remote httpsUrl.
e retry ] ]

0 comments on commit 0ddc038

Please sign in to comment.