sha1-file.c: remove the_repo from read_object_with_reference()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
							parent
							
								
									8dca754b1e
								
							
						
					
					
						commit
						d3b4705ab8
					
				|  | @ -172,7 +172,8 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name, | ||||||
| 			 * fall-back to the usual case. | 			 * fall-back to the usual case. | ||||||
| 			 */ | 			 */ | ||||||
| 		} | 		} | ||||||
| 		buf = read_object_with_reference(&oid, exp_type, &size, NULL); | 		buf = read_object_with_reference(the_repository, | ||||||
|  | 						 &oid, exp_type, &size, NULL); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 	default: | 	default: | ||||||
|  |  | ||||||
|  | @ -458,7 +458,8 @@ static int grep_submodule(struct grep_opt *opt, | ||||||
| 		object = parse_object_or_die(oid, oid_to_hex(oid)); | 		object = parse_object_or_die(oid, oid_to_hex(oid)); | ||||||
|  |  | ||||||
| 		grep_read_lock(); | 		grep_read_lock(); | ||||||
| 		data = read_object_with_reference(&object->oid, tree_type, | 		data = read_object_with_reference(&subrepo, | ||||||
|  | 						  &object->oid, tree_type, | ||||||
| 						  &size, NULL); | 						  &size, NULL); | ||||||
| 		grep_read_unlock(); | 		grep_read_unlock(); | ||||||
|  |  | ||||||
|  | @ -623,7 +624,8 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec, | ||||||
| 		int hit, len; | 		int hit, len; | ||||||
|  |  | ||||||
| 		grep_read_lock(); | 		grep_read_lock(); | ||||||
| 		data = read_object_with_reference(&obj->oid, tree_type, | 		data = read_object_with_reference(opt->repo, | ||||||
|  | 						  &obj->oid, tree_type, | ||||||
| 						  &size, NULL); | 						  &size, NULL); | ||||||
| 		grep_read_unlock(); | 		grep_read_unlock(); | ||||||
|  |  | ||||||
|  |  | ||||||
|  | @ -1428,7 +1428,8 @@ static void add_preferred_base(struct object_id *oid) | ||||||
| 	if (window <= num_preferred_base++) | 	if (window <= num_preferred_base++) | ||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
| 	data = read_object_with_reference(oid, tree_type, &size, &tree_oid); | 	data = read_object_with_reference(the_repository, oid, | ||||||
|  | 					  tree_type, &size, &tree_oid); | ||||||
| 	if (!data) | 	if (!data) | ||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
|  |  | ||||||
							
								
								
									
										3
									
								
								cache.h
								
								
								
								
							
							
						
						
									
										3
									
								
								cache.h
								
								
								
								
							|  | @ -1500,7 +1500,8 @@ int df_name_compare(const char *name1, int len1, int mode1, const char *name2, i | ||||||
| int name_compare(const char *name1, size_t len1, const char *name2, size_t len2); | int name_compare(const char *name1, size_t len1, const char *name2, size_t len2); | ||||||
| int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2); | int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2); | ||||||
|  |  | ||||||
| void *read_object_with_reference(const struct object_id *oid, | void *read_object_with_reference(struct repository *r, | ||||||
|  | 				 const struct object_id *oid, | ||||||
| 				 const char *required_type, | 				 const char *required_type, | ||||||
| 				 unsigned long *size, | 				 unsigned long *size, | ||||||
| 				 struct object_id *oid_ret); | 				 struct object_id *oid_ret); | ||||||
|  |  | ||||||
|  | @ -2410,7 +2410,8 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa | ||||||
| 		oidcpy(&commit_oid, &commit_oe->idx.oid); | 		oidcpy(&commit_oid, &commit_oe->idx.oid); | ||||||
| 	} else if (!get_oid(p, &commit_oid)) { | 	} else if (!get_oid(p, &commit_oid)) { | ||||||
| 		unsigned long size; | 		unsigned long size; | ||||||
| 		char *buf = read_object_with_reference(&commit_oid, | 		char *buf = read_object_with_reference(the_repository, | ||||||
|  | 						       &commit_oid, | ||||||
| 						       commit_type, &size, | 						       commit_type, &size, | ||||||
| 						       &commit_oid); | 						       &commit_oid); | ||||||
| 		if (!buf || size < the_hash_algo->hexsz + 6) | 		if (!buf || size < the_hash_algo->hexsz + 6) | ||||||
|  | @ -2482,7 +2483,8 @@ static void parse_from_existing(struct branch *b) | ||||||
| 		unsigned long size; | 		unsigned long size; | ||||||
| 		char *buf; | 		char *buf; | ||||||
|  |  | ||||||
| 		buf = read_object_with_reference(&b->oid, commit_type, &size, | 		buf = read_object_with_reference(the_repository, | ||||||
|  | 						 &b->oid, commit_type, &size, | ||||||
| 						 &b->oid); | 						 &b->oid); | ||||||
| 		parse_from_commit(b, buf, size); | 		parse_from_commit(b, buf, size); | ||||||
| 		free(buf); | 		free(buf); | ||||||
|  | @ -2560,7 +2562,8 @@ static struct hash_list *parse_merge(unsigned int *count) | ||||||
| 			oidcpy(&n->oid, &oe->idx.oid); | 			oidcpy(&n->oid, &oe->idx.oid); | ||||||
| 		} else if (!get_oid(from, &n->oid)) { | 		} else if (!get_oid(from, &n->oid)) { | ||||||
| 			unsigned long size; | 			unsigned long size; | ||||||
| 			char *buf = read_object_with_reference(&n->oid, | 			char *buf = read_object_with_reference(the_repository, | ||||||
|  | 							       &n->oid, | ||||||
| 							       commit_type, | 							       commit_type, | ||||||
| 							       &size, &n->oid); | 							       &size, &n->oid); | ||||||
| 			if (!buf || size < the_hash_algo->hexsz + 6) | 			if (!buf || size < the_hash_algo->hexsz + 6) | ||||||
|  |  | ||||||
|  | @ -1505,7 +1505,8 @@ void *read_object_file_extended(struct repository *r, | ||||||
| 	return NULL; | 	return NULL; | ||||||
| } | } | ||||||
|  |  | ||||||
| void *read_object_with_reference(const struct object_id *oid, | void *read_object_with_reference(struct repository *r, | ||||||
|  | 				 const struct object_id *oid, | ||||||
| 				 const char *required_type_name, | 				 const char *required_type_name, | ||||||
| 				 unsigned long *size, | 				 unsigned long *size, | ||||||
| 				 struct object_id *actual_oid_return) | 				 struct object_id *actual_oid_return) | ||||||
|  | @ -1521,7 +1522,7 @@ void *read_object_with_reference(const struct object_id *oid, | ||||||
| 		int ref_length = -1; | 		int ref_length = -1; | ||||||
| 		const char *ref_type = NULL; | 		const char *ref_type = NULL; | ||||||
|  |  | ||||||
| 		buffer = read_object_file(&actual_oid, &type, &isize); | 		buffer = repo_read_object_file(r, &actual_oid, &type, &isize); | ||||||
| 		if (!buffer) | 		if (!buffer) | ||||||
| 			return NULL; | 			return NULL; | ||||||
| 		if (type == required_type) { | 		if (type == required_type) { | ||||||
|  |  | ||||||
|  | @ -87,7 +87,7 @@ void *fill_tree_descriptor(struct tree_desc *desc, const struct object_id *oid) | ||||||
| 	void *buf = NULL; | 	void *buf = NULL; | ||||||
|  |  | ||||||
| 	if (oid) { | 	if (oid) { | ||||||
| 		buf = read_object_with_reference(oid, tree_type, &size, NULL); | 		buf = read_object_with_reference(the_repository, oid, tree_type, &size, NULL); | ||||||
| 		if (!buf) | 		if (!buf) | ||||||
| 			die("unable to read tree %s", oid_to_hex(oid)); | 			die("unable to read tree %s", oid_to_hex(oid)); | ||||||
| 	} | 	} | ||||||
|  | @ -542,7 +542,7 @@ int get_tree_entry(const struct object_id *tree_oid, const char *name, struct ob | ||||||
| 	unsigned long size; | 	unsigned long size; | ||||||
| 	struct object_id root; | 	struct object_id root; | ||||||
|  |  | ||||||
| 	tree = read_object_with_reference(tree_oid, tree_type, &size, &root); | 	tree = read_object_with_reference(the_repository, tree_oid, tree_type, &size, &root); | ||||||
| 	if (!tree) | 	if (!tree) | ||||||
| 		return -1; | 		return -1; | ||||||
|  |  | ||||||
|  | @ -609,7 +609,8 @@ enum get_oid_result get_tree_entry_follow_symlinks(struct object_id *tree_oid, c | ||||||
| 			void *tree; | 			void *tree; | ||||||
| 			struct object_id root; | 			struct object_id root; | ||||||
| 			unsigned long size; | 			unsigned long size; | ||||||
| 			tree = read_object_with_reference(¤t_tree_oid, | 			tree = read_object_with_reference(the_repository, | ||||||
|  | 							  ¤t_tree_oid, | ||||||
| 							  tree_type, &size, | 							  tree_type, &size, | ||||||
| 							  &root); | 							  &root); | ||||||
| 			if (!tree) | 			if (!tree) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Nguyễn Thái Ngọc Duy
						Nguyễn Thái Ngọc Duy