pharo-vcs / iceberg

Iceberg is the main toolset for handling VCS in Pharo.
MIT License
133 stars 84 forks source link

Enable option to use local git cache of git repo if there are network issues when trying to connect to remote #1596

Open botwhytho opened 2 years ago

botwhytho commented 2 years ago

When running code like below, if there is no network connection, the code will fail, even if there is a local git copy on the machine.

Metacello new
    baseline: 'MyProject';
    repository: 'github://myproject';
    load.
botwhytho commented 2 years ago

I've coded workarounds like below, but considering I'm introspecting with instVarNamed: we probably need to expose error codes from libgit a bit more officially

[Metacello new
  baseline: 'ABaseline';
  repository: 'github://aPath';
  load. ]
on: IceGenericError
do: [:anError|
  (anError instVarNamed: #wrappedException) object = LGitErrorTypeEnum giterr_net
    ifTrue: [
      Metacello new
      baseline: 'ABaseline';
      repository: 'gitlocal://aPath';
      load.         
]