sha1-name.c: remove the_repo from get_oid_basic()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
		 Nguyễn Thái Ngọc Duy
					Nguyễn Thái Ngọc Duy
				
			
				
					committed by
					
						 Junio C Hamano
						Junio C Hamano
					
				
			
			
				
	
			
			
			 Junio C Hamano
						Junio C Hamano
					
				
			
						parent
						
							0c6b5ba1bb
						
					
				
				
					commit
					49281cf544
				
			
							
								
								
									
										25
									
								
								sha1-name.c
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								sha1-name.c
									
									
									
									
									
								
							| @ -773,8 +773,8 @@ static inline int push_mark(const char *string, int len) | ||||
| static enum get_oid_result get_oid_1(const char *name, int len, struct object_id *oid, unsigned lookup_flags); | ||||
| static int interpret_nth_prior_checkout(struct repository *r, const char *name, int namelen, struct strbuf *buf); | ||||
|  | ||||
| static int get_oid_basic(const char *str, int len, struct object_id *oid, | ||||
| 			  unsigned int flags) | ||||
| static int get_oid_basic(struct repository *r, const char *str, int len, | ||||
| 			 struct object_id *oid, unsigned int flags) | ||||
| { | ||||
| 	static const char *warn_msg = "refname '%.*s' is ambiguous."; | ||||
| 	static const char *object_name_msg = N_( | ||||
| @ -792,9 +792,9 @@ static int get_oid_basic(const char *str, int len, struct object_id *oid, | ||||
| 	int refs_found = 0; | ||||
| 	int at, reflog_len, nth_prior = 0; | ||||
|  | ||||
| 	if (len == the_hash_algo->hexsz && !get_oid_hex(str, oid)) { | ||||
| 	if (len == r->hash_algo->hexsz && !get_oid_hex(str, oid)) { | ||||
| 		if (warn_ambiguous_refs && warn_on_object_refname_ambiguity) { | ||||
| 			refs_found = dwim_ref(str, len, &tmp_oid, &real_ref); | ||||
| 			refs_found = repo_dwim_ref(r, str, len, &tmp_oid, &real_ref); | ||||
| 			if (refs_found > 0) { | ||||
| 				warning(warn_msg, len, str); | ||||
| 				if (advice_object_name_warning) | ||||
| @ -835,8 +835,8 @@ static int get_oid_basic(const char *str, int len, struct object_id *oid, | ||||
| 		struct strbuf buf = STRBUF_INIT; | ||||
| 		int detached; | ||||
|  | ||||
| 		if (interpret_nth_prior_checkout(the_repository, str, len, &buf) > 0) { | ||||
| 			detached = (buf.len == the_hash_algo->hexsz && !get_oid_hex(buf.buf, oid)); | ||||
| 		if (interpret_nth_prior_checkout(r, str, len, &buf) > 0) { | ||||
| 			detached = (buf.len == r->hash_algo->hexsz && !get_oid_hex(buf.buf, oid)); | ||||
| 			strbuf_release(&buf); | ||||
| 			if (detached) | ||||
| 				return 0; | ||||
| @ -845,19 +845,18 @@ static int get_oid_basic(const char *str, int len, struct object_id *oid, | ||||
|  | ||||
| 	if (!len && reflog_len) | ||||
| 		/* allow "@{...}" to mean the current branch reflog */ | ||||
| 		refs_found = dwim_ref("HEAD", 4, oid, &real_ref); | ||||
| 		refs_found = repo_dwim_ref(r, "HEAD", 4, oid, &real_ref); | ||||
| 	else if (reflog_len) | ||||
| 		refs_found = dwim_log(str, len, oid, &real_ref); | ||||
| 		refs_found = repo_dwim_log(r, str, len, oid, &real_ref); | ||||
| 	else | ||||
| 		refs_found = dwim_ref(str, len, oid, &real_ref); | ||||
| 		refs_found = repo_dwim_ref(r, str, len, oid, &real_ref); | ||||
|  | ||||
| 	if (!refs_found) | ||||
| 		return -1; | ||||
|  | ||||
| 	if (warn_ambiguous_refs && !(flags & GET_OID_QUIETLY) && | ||||
| 	    (refs_found > 1 || | ||||
| 	     !get_short_oid(the_repository, | ||||
| 			    str, len, &tmp_oid, GET_OID_QUIETLY))) | ||||
| 	     !get_short_oid(r, str, len, &tmp_oid, GET_OID_QUIETLY))) | ||||
| 		warning(warn_msg, len, str); | ||||
|  | ||||
| 	if (reflog_len) { | ||||
| @ -889,7 +888,7 @@ static int get_oid_basic(const char *str, int len, struct object_id *oid, | ||||
| 				return -1; | ||||
| 			} | ||||
| 		} | ||||
| 		if (read_ref_at(get_main_ref_store(the_repository), | ||||
| 		if (read_ref_at(get_main_ref_store(r), | ||||
| 				real_ref, flags, at_time, nth, oid, NULL, | ||||
| 				&co_time, &co_tz, &co_cnt)) { | ||||
| 			if (!len) { | ||||
| @ -1159,7 +1158,7 @@ static enum get_oid_result get_oid_1(const char *name, int len, | ||||
| 	if (!ret) | ||||
| 		return FOUND; | ||||
|  | ||||
| 	ret = get_oid_basic(name, len, oid, lookup_flags); | ||||
| 	ret = get_oid_basic(the_repository, name, len, oid, lookup_flags); | ||||
| 	if (!ret) | ||||
| 		return FOUND; | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user