fast-import: use the diff_delta() max_delta_size argument
This let diff_delta() abort early if it is going to bust the given size limit. Also, only objects larger than 20 bytes are considered as objects smaller than that are most certainly going to produce larger deltas than the original object due to the additional headers. Signed-off-by: Nicolas Pitre <nico@fluxnic.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
		
				
					committed by
					
						
						Junio C Hamano
					
				
			
			
				
	
			
			
			
						parent
						
							8c2ca8dd8a
						
					
				
				
					commit
					b500d5e11e
				
			@ -1041,14 +1041,10 @@ static int store_object(
 | 
				
			|||||||
		return 1;
 | 
							return 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (last && last->data.buf && last->depth < max_depth) {
 | 
						if (last && last->data.buf && last->depth < max_depth && dat->len > 20) {
 | 
				
			||||||
		delta = diff_delta(last->data.buf, last->data.len,
 | 
							delta = diff_delta(last->data.buf, last->data.len,
 | 
				
			||||||
			dat->buf, dat->len,
 | 
								dat->buf, dat->len,
 | 
				
			||||||
			&deltalen, 0);
 | 
								&deltalen, dat->len - 20);
 | 
				
			||||||
		if (delta && deltalen >= dat->len) {
 | 
					 | 
				
			||||||
			free(delta);
 | 
					 | 
				
			||||||
			delta = NULL;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	} else
 | 
						} else
 | 
				
			||||||
		delta = NULL;
 | 
							delta = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user