diff.c: fix "size cache" handling.
We broke the size-cache handling when we changed the function
signature of sha1_object_info() in 21666f1a.  We obviously
wanted to cache the size we obtained when sha1_object_info()
succeeded, not when it failed.
Signed-off-by: Junio C Hamano <junkio@cox.net>
			
			
				maint
			
			
		
							parent
							
								
									9cf04301b1
								
							
						
					
					
						commit
						cdda666201
					
				
							
								
								
									
										9
									
								
								diff.c
								
								
								
								
							
							
						
						
									
										9
									
								
								diff.c
								
								
								
								
							|  | @ -1468,14 +1468,15 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only) | ||||||
| 		enum object_type type; | 		enum object_type type; | ||||||
| 		struct sha1_size_cache *e; | 		struct sha1_size_cache *e; | ||||||
|  |  | ||||||
| 		if (size_only) { | 		if (size_only && use_size_cache && | ||||||
| 			e = locate_size_cache(s->sha1, 1, 0); | 		    (e = locate_size_cache(s->sha1, 1, 0)) != NULL) { | ||||||
| 			if (e) { |  | ||||||
| 			s->size = e->size; | 			s->size = e->size; | ||||||
| 			return 0; | 			return 0; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | 		if (size_only) { | ||||||
| 			type = sha1_object_info(s->sha1, &s->size); | 			type = sha1_object_info(s->sha1, &s->size); | ||||||
| 			if (type < 0) | 			if (use_size_cache && 0 < type) | ||||||
| 				locate_size_cache(s->sha1, 0, s->size); | 				locate_size_cache(s->sha1, 0, s->size); | ||||||
| 		} | 		} | ||||||
| 		else { | 		else { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Junio C Hamano
						Junio C Hamano