mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-20 11:44:59 +00:00
fix: for init-commit, app will crash with COMMIT & PUSH
due to local branch has not been updated (#1229)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
f2000b4a84
commit
87ebe3741d
2 changed files with 15 additions and 1 deletions
|
@ -114,6 +114,9 @@ namespace SourceGit.ViewModels
|
|||
// Set default selected local branch.
|
||||
if (localBranch != null)
|
||||
{
|
||||
if (LocalBranches.Count == 0)
|
||||
LocalBranches.Add(localBranch);
|
||||
|
||||
_selectedLocalBranch = localBranch;
|
||||
HasSpecifiedLocalBranch = true;
|
||||
}
|
||||
|
|
|
@ -1733,7 +1733,18 @@ namespace SourceGit.ViewModels
|
|||
UseAmend = false;
|
||||
|
||||
if (autoPush && _repo.Remotes.Count > 0)
|
||||
_repo.ShowAndStartPopup(new Push(_repo, null));
|
||||
{
|
||||
if (_repo.CurrentBranch == null)
|
||||
{
|
||||
var currentBranchName = Commands.Branch.ShowCurrent(_repo.FullPath);
|
||||
var tmp = new Models.Branch() { Name = currentBranchName };
|
||||
_repo.ShowAndStartPopup(new Push(_repo, tmp));
|
||||
}
|
||||
else
|
||||
{
|
||||
_repo.ShowAndStartPopup(new Push(_repo, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_repo.MarkBranchesDirtyManually();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue