@@ -41,12 +41,11 @@ public int Bookmark
4141 public OpenLocalRepository ( string pageId , RepositoryNode group )
4242 {
4343 _pageId = pageId ;
44- _group = group ;
4544
4645 Groups = new List < RepositoryNode > ( ) ;
46+ Groups . Add ( new RepositoryNode { Name = "No Group (Uncategorized)" , Id = string . Empty } ) ;
47+ Group = group ?? Groups [ 0 ] ;
4748 CollectGroups ( Groups , Preferences . Instance . RepositoryNodes ) ;
48- if ( Groups . Count > 0 && _group == null )
49- Group = Groups [ 0 ] ;
5049
5150 Bookmarks = new List < int > ( ) ;
5251 for ( var i = 0 ; i < Models . Bookmarks . Brushes . Length ; i ++ )
@@ -63,6 +62,7 @@ public static ValidationResult ValidateRepoPath(string folder, ValidationContext
6362 public override async Task < bool > Sure ( )
6463 {
6564 var isBare = await new Commands . IsBareRepository ( _repoPath ) . GetResultAsync ( ) ;
65+ var parent = _group is { Id : not "" } ? _group : null ;
6666 var repoRoot = _repoPath ;
6767 if ( ! isBare )
6868 {
@@ -78,7 +78,7 @@ public override async Task<bool> Sure()
7878 {
7979 if ( page . Node . Id . Equals ( _pageId , StringComparison . Ordinal ) )
8080 {
81- page . Popup = new Init ( page . Node . Id , _repoPath , _group , test . StdErr ) ;
81+ page . Popup = new Init ( page . Node . Id , _repoPath , parent , test . StdErr ) ;
8282 break ;
8383 }
8484 }
@@ -87,7 +87,7 @@ public override async Task<bool> Sure()
8787 }
8888 }
8989
90- var node = Preferences . Instance . FindOrAddNodeByRepositoryPath ( repoRoot , _group , true ) ;
90+ var node = Preferences . Instance . FindOrAddNodeByRepositoryPath ( repoRoot , parent , true ) ;
9191 node . Bookmark = _bookmark ;
9292 await node . UpdateStatusAsync ( false , null ) ;
9393 Welcome . Instance . Refresh ( ) ;
0 commit comments