88////////////////////////////////////////////////////////////////////////////////////////
99
1010using GitReader ;
11- using GitReader . Structures ;
11+ using GitReader . Primitive ;
1212using NUnit . Framework ;
1313using System ;
1414using System . IO ;
@@ -42,54 +42,54 @@ public async Task LookupVersionLabelWithWorkingDirectoryChanges()
4242
4343 // Test 1: Clean working directory - should return tagged version
4444 Hash root ;
45- using ( var repository = await Repository . Factory . OpenStructureAsync ( tempPath ) )
45+ using ( var repository = await Repository . Factory . OpenPrimitiveAsync ( tempPath ) )
4646 {
47- root = repository . Head ! . Head ;
47+ root = ( await repository . GetCurrentHeadReferenceAsync ( ) ) ! . Value ;
4848
4949 var version = await Analyzer . LookupVersionLabelAsync ( repository , true , default ) ;
5050 Assert . That ( version . ToString ( ) , Is . EqualTo ( "1.2.3" ) ) ;
5151 }
5252
5353 // Test 2: Modified file (unstaged) - should increment version
5454 File . WriteAllText ( testFile , "modified content" ) ;
55- using ( var repository = await Repository . Factory . OpenStructureAsync ( tempPath ) )
55+ using ( var repository = await Repository . Factory . OpenPrimitiveAsync ( tempPath ) )
5656 {
5757 var version = await Analyzer . LookupVersionLabelAsync ( repository , true , default ) ;
5858 Assert . That ( version . ToString ( ) , Is . EqualTo ( "1.2.4" ) ) ;
5959 }
6060
6161 // Test 3: Staged file - should increment version
6262 await TestUtilities . RunGitCommand ( tempPath , "add test.txt" ) ;
63- using ( var repository = await Repository . Factory . OpenStructureAsync ( tempPath ) )
63+ using ( var repository = await Repository . Factory . OpenPrimitiveAsync ( tempPath ) )
6464 {
6565 var version = await Analyzer . LookupVersionLabelAsync ( repository , true , default ) ;
6666 Assert . That ( version . ToString ( ) , Is . EqualTo ( "1.2.4" ) ) ;
6767 }
6868
6969 // Test 4: Commit staged file and test untracked file
7070 await TestUtilities . RunGitCommand ( tempPath , "commit -m \" Test\" " ) ;
71- using ( var repository = await Repository . Factory . OpenStructureAsync ( tempPath ) )
71+ using ( var repository = await Repository . Factory . OpenPrimitiveAsync ( tempPath ) )
7272 {
7373 var version = await Analyzer . LookupVersionLabelAsync ( repository , true , default ) ;
7474 Assert . That ( version . ToString ( ) , Is . EqualTo ( "1.2.4" ) ) ;
7575 }
7676 var untrackedFile = Path . Combine ( tempPath , "untracked.txt" ) ;
7777 File . WriteAllText ( untrackedFile , "untracked content" ) ;
78- using ( var repository = await Repository . Factory . OpenStructureAsync ( tempPath ) )
78+ using ( var repository = await Repository . Factory . OpenPrimitiveAsync ( tempPath ) )
7979 {
8080 var version = await Analyzer . LookupVersionLabelAsync ( repository , true , default ) ;
8181 Assert . That ( version . ToString ( ) , Is . EqualTo ( "1.2.5" ) ) ;
8282 }
8383
8484 // Test 5: Reset
8585 await TestUtilities . RunGitCommand ( tempPath , $ "reset --hard { root } ") ;
86- using ( var repository = await Repository . Factory . OpenStructureAsync ( tempPath ) )
86+ using ( var repository = await Repository . Factory . OpenPrimitiveAsync ( tempPath ) )
8787 {
8888 var version = await Analyzer . LookupVersionLabelAsync ( repository , true , default ) ;
8989 Assert . That ( version . ToString ( ) , Is . EqualTo ( "1.2.4" ) ) ;
9090 }
9191 await TestUtilities . RunGitCommand ( tempPath , $ "clean -xfd") ; // Remove `untracked.txt`
92- using ( var repository = await Repository . Factory . OpenStructureAsync ( tempPath ) )
92+ using ( var repository = await Repository . Factory . OpenPrimitiveAsync ( tempPath ) )
9393 {
9494 var version = await Analyzer . LookupVersionLabelAsync ( repository , true , default ) ;
9595 Assert . That ( version . ToString ( ) , Is . EqualTo ( "1.2.3" ) ) ;
@@ -127,7 +127,7 @@ public async Task LookupVersionLabelWithInitialRepository()
127127 await TestUtilities . RunGitCommand ( tempPath , "config user.name \" Test User\" " ) ;
128128
129129 // Test 1: Initial repository with no commits and no files - should return default version
130- using ( var repository = await Repository . Factory . OpenStructureAsync ( tempPath ) )
130+ using ( var repository = await Repository . Factory . OpenPrimitiveAsync ( tempPath ) )
131131 {
132132 var version = await Analyzer . LookupVersionLabelAsync ( repository , false , default ) ;
133133 Assert . That ( version . ToString ( ) , Is . EqualTo ( "0.0.1" ) ) ;
@@ -136,15 +136,15 @@ public async Task LookupVersionLabelWithInitialRepository()
136136 // Test 2: Initial repository with untracked file - should still return default version
137137 var testFile = Path . Combine ( tempPath , "test.txt" ) ;
138138 File . WriteAllText ( testFile , "content" ) ;
139- using ( var repository = await Repository . Factory . OpenStructureAsync ( tempPath ) )
139+ using ( var repository = await Repository . Factory . OpenPrimitiveAsync ( tempPath ) )
140140 {
141141 var version = await Analyzer . LookupVersionLabelAsync ( repository , false , default ) ;
142142 Assert . That ( version . ToString ( ) , Is . EqualTo ( "0.0.1" ) ) ;
143143 }
144144
145145 // Test 3: Initial repository with staged file (but no commits) - should still return default version
146146 await TestUtilities . RunGitCommand ( tempPath , "add test.txt" ) ;
147- using ( var repository = await Repository . Factory . OpenStructureAsync ( tempPath ) )
147+ using ( var repository = await Repository . Factory . OpenPrimitiveAsync ( tempPath ) )
148148 {
149149 var version = await Analyzer . LookupVersionLabelAsync ( repository , false , default ) ;
150150 Assert . That ( version . ToString ( ) , Is . EqualTo ( "0.0.1" ) ) ;
@@ -153,7 +153,7 @@ public async Task LookupVersionLabelWithInitialRepository()
153153 // Test 4: Initial repository with unstaged changes after staging - should still return default version
154154 // First modify the staged file to create unstaged changes
155155 File . WriteAllText ( testFile , "modified content" ) ;
156- using ( var repository = await Repository . Factory . OpenStructureAsync ( tempPath ) )
156+ using ( var repository = await Repository . Factory . OpenPrimitiveAsync ( tempPath ) )
157157 {
158158 var version = await Analyzer . LookupVersionLabelAsync ( repository , false , default ) ;
159159 Assert . That ( version . ToString ( ) , Is . EqualTo ( "0.0.1" ) ) ;
@@ -163,7 +163,7 @@ public async Task LookupVersionLabelWithInitialRepository()
163163 var testFile2 = Path . Combine ( tempPath , "test2.txt" ) ;
164164 File . WriteAllText ( testFile2 , "second file content" ) ;
165165 await TestUtilities . RunGitCommand ( tempPath , "add test2.txt" ) ;
166- using ( var repository = await Repository . Factory . OpenStructureAsync ( tempPath ) )
166+ using ( var repository = await Repository . Factory . OpenPrimitiveAsync ( tempPath ) )
167167 {
168168 var version = await Analyzer . LookupVersionLabelAsync ( repository , false , default ) ;
169169 Assert . That ( version . ToString ( ) , Is . EqualTo ( "0.0.1" ) ) ;
0 commit comments