When adding a remote rm the old remote with the same name

This is a problem when setting up the remote fails.
This commit is contained in:
Vishesh Handa
2020-11-07 14:17:41 +01:00
parent 2bb0646f48
commit 3000d94123
3 changed files with 11 additions and 6 deletions

View File

@ -502,6 +502,11 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
String error;
try {
var repo = await GitRepository.load(repoPath);
var remotes = repo.config.remotes;
var i = remotes.indexWhere((r) => r.name == widget.remoteName);
if (i != -1) {
await repo.removeRemote(widget.remoteName);
}
await repo.addRemote(widget.remoteName, _gitCloneUrl);
var repoN = git_bindings.GitRepo(folderPath: repoPath);

View File

@ -181,10 +181,10 @@ packages:
description:
path: "."
ref: HEAD
resolved-ref: "071cb643a4924a45986920f44c0e2433ee9159ed"
url: "https://github.com/GitJournal/dart_git.git"
resolved-ref: b489bbb315e066b332e438747c1359004ff2b244
url: "https://github.com/GitJournal/dart-git.git"
source: git
version: "0.0.1"
version: "0.0.2"
device_info:
dependency: "direct main"
description:
@ -1165,5 +1165,5 @@ packages:
source: hosted
version: "0.0.9"
sdks:
dart: ">=2.10.0-110 <2.11.0"
dart: ">=2.10.1 <2.11.0"
flutter: ">=1.20.0 <2.0.0"

View File

@ -33,8 +33,8 @@ dependencies:
#path: /Users/vishesh/src/gitjournal/git_bindings
git: https://github.com/GitJournal/git_bindings.git
dart_git:
git: https://github.com/GitJournal/dart_git.git
#path: /Users/vishesh/src/gitjournal/dart_git
git: https://github.com/GitJournal/dart-git.git
#path: /Users/vishesh/src/gitjournal/dart-git
yaml_serializer: ^0.0.9
connectivity: ^0.4.6+1
flutter_emoji: ">= 2.0.0"