mirror of
				https://git.proxmox.com/git/libgit2
				synced 2025-10-31 21:35:31 +00:00 
			
		
		
		
	 f5e28202cb
			
		
	
	
		f5e28202cb
		
	
	
	
	
		
			
			Currently, the odb cache has a fixed size of 128 slots as defined by GIT_DEFAULT_CACHE_SIZE. Allow users to set the size of the cache via git_libgit2_opts(). Fixes #1035.
		
			
				
	
	
		
			31 lines
		
	
	
		
			827 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			827 B
		
	
	
	
		
			C
		
	
	
	
	
	
| #include "clar_libgit2.h"
 | |
| #include "cache.h"
 | |
| 
 | |
| void test_core_opts__readwrite(void)
 | |
| {
 | |
| 	size_t old_val = 0;
 | |
| 	size_t new_val = 0;
 | |
| 
 | |
| 	git_libgit2_opts(GIT_OPT_GET_MWINDOW_SIZE, &old_val);
 | |
| 	git_libgit2_opts(GIT_OPT_SET_MWINDOW_SIZE, (size_t)1234);
 | |
| 	git_libgit2_opts(GIT_OPT_GET_MWINDOW_SIZE, &new_val);
 | |
| 
 | |
| 	cl_assert(new_val == 1234);
 | |
| 
 | |
| 	git_libgit2_opts(GIT_OPT_SET_MWINDOW_SIZE, old_val);
 | |
| 	git_libgit2_opts(GIT_OPT_GET_MWINDOW_SIZE, &new_val);
 | |
| 
 | |
| 	cl_assert(new_val == old_val);
 | |
| 
 | |
| 	git_libgit2_opts(GIT_OPT_GET_ODB_CACHE_SIZE, &old_val);
 | |
| 
 | |
| 	cl_assert(old_val == GIT_DEFAULT_CACHE_SIZE);
 | |
| 
 | |
| 	git_libgit2_opts(GIT_OPT_SET_ODB_CACHE_SIZE, (size_t)GIT_DEFAULT_CACHE_SIZE*2);
 | |
| 	git_libgit2_opts(GIT_OPT_GET_ODB_CACHE_SIZE, &new_val);
 | |
| 
 | |
| 	cl_assert(new_val == (GIT_DEFAULT_CACHE_SIZE*2));
 | |
| 
 | |
| 	git_libgit2_opts(GIT_OPT_GET_ODB_CACHE_SIZE, &old_val);
 | |
| }
 |