mirror of
				https://git.proxmox.com/git/libgit2
				synced 2025-10-31 04:26:55 +00:00 
			
		
		
		
	tests: index::version: add test to read index version v4
While we have a simple test to determine whether we can write an index of version 4, we never verified that we are able to read this kind of index (and in fact, we were not able to do so). Add a new repository which has an index of version 4. This repository is then read from a new test.
This commit is contained in:
		
							parent
							
								
									fea0c81e95
								
							
						
					
					
						commit
						82368b1bad
					
				| @ -9,6 +9,29 @@ void test_index_version__cleanup(void) | ||||
|         g_repo = NULL; | ||||
| } | ||||
| 
 | ||||
| void test_index_version__can_read_v4(void) | ||||
| { | ||||
| 	const char *paths[] = { | ||||
| 	    "file.tx", "file.txt", "file.txz", "foo", "zzz", | ||||
| 	}; | ||||
| 	git_index *index; | ||||
| 	size_t i; | ||||
| 
 | ||||
| 	g_repo = cl_git_sandbox_init("indexv4"); | ||||
| 
 | ||||
| 	cl_git_pass(git_repository_index(&index, g_repo)); | ||||
| 	cl_assert_equal_sz(git_index_entrycount(index), 5); | ||||
| 
 | ||||
| 	for (i = 0; i < ARRAY_SIZE(paths); i++) { | ||||
| 		const git_index_entry *entry = | ||||
| 		    git_index_get_bypath(index, paths[i], GIT_INDEX_STAGE_NORMAL); | ||||
| 
 | ||||
| 		cl_assert(entry != NULL); | ||||
| 	} | ||||
| 
 | ||||
| 	git_index_free(index); | ||||
| } | ||||
| 
 | ||||
| void test_index_version__can_write_v4(void) | ||||
| { | ||||
| 	git_index *index; | ||||
|  | ||||
							
								
								
									
										
											BIN
										
									
								
								tests/resources/indexv4/.gitted/HEAD
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								tests/resources/indexv4/.gitted/HEAD
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								tests/resources/indexv4/.gitted/config
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								tests/resources/indexv4/.gitted/config
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								tests/resources/indexv4/.gitted/index
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								tests/resources/indexv4/.gitted/index
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								tests/resources/indexv4/.gitted/refs/heads/master
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								tests/resources/indexv4/.gitted/refs/heads/master
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										0
									
								
								tests/resources/indexv4/file.tx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								tests/resources/indexv4/file.tx
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								tests/resources/indexv4/file.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								tests/resources/indexv4/file.txt
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								tests/resources/indexv4/file.txz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								tests/resources/indexv4/file.txz
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								tests/resources/indexv4/foo
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								tests/resources/indexv4/foo
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								tests/resources/indexv4/zzz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								tests/resources/indexv4/zzz
									
									
									
									
									
										Normal file
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Patrick Steinhardt
						Patrick Steinhardt