This repository was archived by the owner on Dec 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
src/UnityExtension/Assets/Editor/GitHub.Unity/UI Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 3
3
using System . Linq ;
4
4
using UnityEditor ;
5
5
using UnityEngine ;
6
+ using Debug = System . Diagnostics . Debug ;
6
7
7
8
namespace GitHub . Unity
8
9
{
@@ -17,6 +18,7 @@ class BranchesView : Subview
17
18
private const string NewBranchConfirmButton = "Create" ;
18
19
private const string FavoritesSetting = "Favorites" ;
19
20
private const string FavoritesTitle = "Favorites" ;
21
+ private const string CreateBranchTitle = "Create branch" ;
20
22
private const string LocalTitle = "Local branches" ;
21
23
private const string RemoteTitle = "Remote branches" ;
22
24
private const string CreateBranchButton = "New Branch" ;
@@ -500,7 +502,21 @@ private void OnCreateGUI()
500
502
if ( createBranch )
501
503
{
502
504
GitClient . CreateBranch ( newBranchName , selectedNode . Name )
503
- . FinallyInUI ( ( success , e ) => { if ( success ) Refresh ( ) ; } )
505
+ . FinallyInUI ( ( success , e ) => {
506
+ if ( success )
507
+ {
508
+ Refresh ( ) ;
509
+ }
510
+ else
511
+ {
512
+ var errorHeader = "fatal: " ;
513
+ var errorMessage = e . Message . StartsWith ( errorHeader ) ? e . Message . Remove ( 0 , errorHeader . Length ) : e . Message ;
514
+
515
+ EditorUtility . DisplayDialog ( CreateBranchTitle ,
516
+ errorMessage ,
517
+ Localization . Cancel ) ;
518
+ }
519
+ } )
504
520
. Start ( ) ;
505
521
}
506
522
You can’t perform that action at this time.
0 commit comments