mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-09-21 16:00:56 +08:00
Fix setting up an empty repo
Fixes APP-EQ
This commit is contained in:
@ -194,6 +194,15 @@ class GitNoteRepository {
|
||||
assert(branchConfig.name != null);
|
||||
assert(branchConfig.merge != null);
|
||||
|
||||
var remoteRef = await repo.remoteBranch(
|
||||
branchConfig.remote,
|
||||
branchConfig.trackingBranch(),
|
||||
);
|
||||
if (remoteRef == null) {
|
||||
Log.i('Remote has no refs');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await _gitRepo.merge(
|
||||
branch: branchConfig.remoteTrackingBranch(),
|
||||
|
@ -516,6 +516,7 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
|
||||
}
|
||||
|
||||
if (error != null && error.isNotEmpty) {
|
||||
Log.i("Not completing gitClone because of error");
|
||||
setState(() {
|
||||
logEvent(Event.GitHostSetupGitCloneError, parameters: {
|
||||
'error': error,
|
||||
@ -529,7 +530,8 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
|
||||
// Add a GitIgnore file. This way we always at least have one commit
|
||||
// It makes doing a git pull and push easier
|
||||
//
|
||||
var anyFileInRepo = Directory(repoPath).list().firstWhere(
|
||||
var dirList = await Directory(repoPath).list().toList();
|
||||
var anyFileInRepo = dirList.firstWhere(
|
||||
(fs) => fs.statSync().type == FileSystemEntityType.file,
|
||||
orElse: () => null,
|
||||
);
|
||||
|
@ -335,13 +335,15 @@ class StateContainer with ChangeNotifier {
|
||||
var repo = await GitRepository.load(repoPath);
|
||||
var remote = repo.config.remote(remoteName);
|
||||
var remoteBranch = await repo.guessRemoteHead(remoteName);
|
||||
var remoteBranchName = remoteBranch.name.branchName();
|
||||
var remoteBranchName =
|
||||
remoteBranch != null ? remoteBranch.name.branchName() : "master";
|
||||
|
||||
var branches = await repo.branches();
|
||||
if (branches.isEmpty) {
|
||||
Log.i("Completing - no local branch");
|
||||
assert(remoteBranch.isHash);
|
||||
if (remoteBranch != null) {
|
||||
await repo.checkoutBranch(remoteBranchName, remoteBranch.hash);
|
||||
}
|
||||
await repo.setUpstreamTo(remote, remoteBranchName);
|
||||
} else {
|
||||
var branch = branches[0];
|
||||
|
10
pubspec.lock
10
pubspec.lock
@ -181,7 +181,7 @@ packages:
|
||||
description:
|
||||
path: "."
|
||||
ref: HEAD
|
||||
resolved-ref: "156ac4e589cf8a67c126e5c7c18f6ca76c6c232e"
|
||||
resolved-ref: "071cb643a4924a45986920f44c0e2433ee9159ed"
|
||||
url: "https://github.com/GitJournal/dart_git.git"
|
||||
source: git
|
||||
version: "0.0.1"
|
||||
@ -435,9 +435,11 @@ packages:
|
||||
git_bindings:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: git_bindings
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
path: "."
|
||||
ref: HEAD
|
||||
resolved-ref: e7e957acdaff208744b5b1fff9a611cbfbd1de34
|
||||
url: "https://github.com/GitJournal/git_bindings.git"
|
||||
source: git
|
||||
version: "0.0.18"
|
||||
git_url_parse2:
|
||||
dependency: "direct main"
|
||||
|
@ -29,7 +29,9 @@ dependencies:
|
||||
dynamic_theme: ^1.0.0
|
||||
flutter_staggered_grid_view: ^0.3.0
|
||||
provider: ^4.3.2+2
|
||||
git_bindings: ^0.0.18
|
||||
git_bindings: #^0.0.18
|
||||
#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
|
||||
|
Reference in New Issue
Block a user