mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
fix<*>: fix crash while creating branch with empty repository
This commit is contained in:
parent
284e8077d6
commit
f4237efaa2
4 changed files with 43 additions and 36 deletions
|
@ -20,8 +20,10 @@ namespace SourceGit.Commands {
|
|||
return Exec();
|
||||
}
|
||||
|
||||
public bool Branch(string branch, string basedOn) {
|
||||
Args = $"checkout -b {branch} {basedOn}";
|
||||
public bool Branch(string branch, string basedOn, Action<string> onProgress) {
|
||||
Args = $"checkout --progress -b {branch} {basedOn}";
|
||||
TraitErrorAsOutput = true;
|
||||
handler = onProgress;
|
||||
return Exec();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,10 +13,10 @@ namespace SourceGit.Commands {
|
|||
var current = branches.Find(x => x.IsCurrent);
|
||||
|
||||
var masterBranch = branches.Find(x => x.Name == master);
|
||||
if (masterBranch == null) new Branch(Cwd, master).Create(current.Head);
|
||||
if (masterBranch == null && current != null) new Branch(Cwd, develop).Create(current.Head);
|
||||
|
||||
var devBranch = branches.Find(x => x.Name == develop);
|
||||
if (devBranch == null) new Branch(Cwd, develop).Create(current.Head);
|
||||
if (devBranch == null && current != null) new Branch(Cwd, develop).Create(current.Head);
|
||||
|
||||
var cmd = new Config(Cwd);
|
||||
cmd.Set("gitflow.branch.master", master);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue