Try to guess the remote's default branch

This is an ugly hack and a proper solution should be implemented.
This commit is contained in:
Vishesh Handa
2020-10-16 14:08:47 +02:00
parent f44c1ce17d
commit c63b984443
2 changed files with 2 additions and 9 deletions

View File

@ -331,21 +331,14 @@ class StateContainer with ChangeNotifier {
});
}
// FIXME: Pass the remote name that was added
void completeGitHostSetup(String repoFolderName, String remoteName) {
() async {
var repo = await GitRepository.load(_gitRepo.gitDirPath);
var remote = repo.config.remote(remoteName);
var remoteBranchName = 'master';
var remoteBranchName = await repo.guessRemoteHead(remoteName);
// FIXME: How to get this?
//
// There is no way to get it, just need to iterate over the refs
// and look for one!
await repo.setUpstreamTo(remote, remoteBranchName);
// At this point the remote should have been added and fetched
await _gitRepo.merge();
settings.remoteGitRepoConfigured = true;

View File

@ -181,7 +181,7 @@ packages:
description:
path: "."
ref: HEAD
resolved-ref: aed5883fd17219c778cdf2d0d613a873d0b20f6c
resolved-ref: "09bc129de57f8c179305a99ca1b9a885a4807c3f"
url: "https://github.com/GitJournal/dart_git.git"
source: git
version: "0.0.1"