optimize<CreateBranch>: 增加一个对于空仓库建立分支的错误提示

This commit is contained in:
ZCShou 2021-05-27 14:23:06 +08:00
parent f4237efaa2
commit 8191758a97
3 changed files with 7 additions and 1 deletions

View file

@ -96,6 +96,7 @@
<sys:String x:Key="Text.CreateBranch.LocalChanges.StashAndReply">Stash &amp; Reapply</sys:String>
<sys:String x:Key="Text.CreateBranch.LocalChanges.Discard">Discard</sys:String>
<sys:String x:Key="Text.CreateBranch.Checkout">Check out after created</sys:String>
<sys:String x:Key="Text.CreateBranch.Idle">Git do not hold any branch until you do first commit.</sys:String>
<sys:String x:Key="Text.CreateTag">Create Tag</sys:String>
<sys:String x:Key="Text.CreateTag.BasedOn">New Tag At :</sys:String>

View file

@ -96,6 +96,7 @@
<sys:String x:Key="Text.CreateBranch.LocalChanges.StashAndReply">贮藏并自动恢复</sys:String>
<sys:String x:Key="Text.CreateBranch.LocalChanges.Discard">忽略</sys:String>
<sys:String x:Key="Text.CreateBranch.Checkout">完成后切换到新分支</sys:String>
<sys:String x:Key="Text.CreateBranch.Idle">对于空仓库只有提交一次有效数据Git 才会创建第一个分支</sys:String>
<sys:String x:Key="Text.CreateTag">新建标签</sys:String>
<sys:String x:Key="Text.CreateTag.BasedOn">标签位于 </sys:String>

View file

@ -401,7 +401,11 @@ namespace SourceGit.Views.Widgets {
private void OpenNewBranch(object sender, RoutedEventArgs e) {
var current = repo.Branches.Find(x => x.IsCurrent);
if (current != null) new Popups.CreateBranch(repo, current).Show();
if (current != null) {
new Popups.CreateBranch(repo, current).Show();
} else {
Models.Exception.Raise(App.Text("CreateBranch.Idle"));
}
e.Handled = true;
}