addOrUpdateRemote method

Future<GitRemoteConfig> addOrUpdateRemote(
  1. String name,
  2. String url
)

Implementation

Future<GitRemoteConfig> addOrUpdateRemote(String name, String url) async {
  var i = config.remotes.indexWhere((r) => r.name == name);
  if (i == -1) {
    return addRemote(name, url);
  }

  config.remotes[i] = GitRemoteConfig(
    name: config.remotes[i].name,
    fetch: config.remotes[i].fetch,
    url: url,
  );
  await saveConfig();

  return config.remotes[i];
}