tag: convert gpg_verify_tag to use struct object_id
Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
							parent
							
								
									8b65a34c4a
								
							
						
					
					
						commit
						84571760ca
					
				|  | @ -111,7 +111,7 @@ static int verify_tag(const char *name, const char *ref, | ||||||
| 	if (fmt_pretty) | 	if (fmt_pretty) | ||||||
| 		flags = GPG_VERIFY_OMIT_STATUS; | 		flags = GPG_VERIFY_OMIT_STATUS; | ||||||
|  |  | ||||||
| 	if (gpg_verify_tag(oid->hash, name, flags)) | 	if (gpg_verify_tag(oid, name, flags)) | ||||||
| 		return -1; | 		return -1; | ||||||
|  |  | ||||||
| 	if (fmt_pretty) | 	if (fmt_pretty) | ||||||
|  |  | ||||||
|  | @ -56,20 +56,21 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	while (i < argc) { | 	while (i < argc) { | ||||||
| 		unsigned char sha1[20]; | 		struct object_id oid; | ||||||
| 		const char *name = argv[i++]; | 		const char *name = argv[i++]; | ||||||
| 		if (get_sha1(name, sha1)) { |  | ||||||
|  | 		if (get_oid(name, &oid)) { | ||||||
| 			had_error = !!error("tag '%s' not found.", name); | 			had_error = !!error("tag '%s' not found.", name); | ||||||
| 			continue; | 			continue; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if (gpg_verify_tag(sha1, name, flags)) { | 		if (gpg_verify_tag(&oid, name, flags)) { | ||||||
| 			had_error = 1; | 			had_error = 1; | ||||||
| 			continue; | 			continue; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if (fmt_pretty) | 		if (fmt_pretty) | ||||||
| 			pretty_print_ref(name, sha1, fmt_pretty); | 			pretty_print_ref(name, oid.hash, fmt_pretty); | ||||||
| 	} | 	} | ||||||
| 	return had_error; | 	return had_error; | ||||||
| } | } | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								tag.c
								
								
								
								
							
							
						
						
									
										10
									
								
								tag.c
								
								
								
								
							|  | @ -33,7 +33,7 @@ static int run_gpg_verify(const char *buf, unsigned long size, unsigned flags) | ||||||
| 	return ret; | 	return ret; | ||||||
| } | } | ||||||
|  |  | ||||||
| int gpg_verify_tag(const unsigned char *sha1, const char *name_to_report, | int gpg_verify_tag(const struct object_id *oid, const char *name_to_report, | ||||||
| 		unsigned flags) | 		unsigned flags) | ||||||
| { | { | ||||||
| 	enum object_type type; | 	enum object_type type; | ||||||
|  | @ -41,20 +41,20 @@ int gpg_verify_tag(const unsigned char *sha1, const char *name_to_report, | ||||||
| 	unsigned long size; | 	unsigned long size; | ||||||
| 	int ret; | 	int ret; | ||||||
|  |  | ||||||
| 	type = sha1_object_info(sha1, NULL); | 	type = sha1_object_info(oid->hash, NULL); | ||||||
| 	if (type != OBJ_TAG) | 	if (type != OBJ_TAG) | ||||||
| 		return error("%s: cannot verify a non-tag object of type %s.", | 		return error("%s: cannot verify a non-tag object of type %s.", | ||||||
| 				name_to_report ? | 				name_to_report ? | ||||||
| 				name_to_report : | 				name_to_report : | ||||||
| 				find_unique_abbrev(sha1, DEFAULT_ABBREV), | 				find_unique_abbrev(oid->hash, DEFAULT_ABBREV), | ||||||
| 				typename(type)); | 				typename(type)); | ||||||
|  |  | ||||||
| 	buf = read_sha1_file(sha1, &type, &size); | 	buf = read_sha1_file(oid->hash, &type, &size); | ||||||
| 	if (!buf) | 	if (!buf) | ||||||
| 		return error("%s: unable to read file.", | 		return error("%s: unable to read file.", | ||||||
| 				name_to_report ? | 				name_to_report ? | ||||||
| 				name_to_report : | 				name_to_report : | ||||||
| 				find_unique_abbrev(sha1, DEFAULT_ABBREV)); | 				find_unique_abbrev(oid->hash, DEFAULT_ABBREV)); | ||||||
|  |  | ||||||
| 	ret = run_gpg_verify(buf, size, flags); | 	ret = run_gpg_verify(buf, size, flags); | ||||||
|  |  | ||||||
|  |  | ||||||
							
								
								
									
										2
									
								
								tag.h
								
								
								
								
							
							
						
						
									
										2
									
								
								tag.h
								
								
								
								
							|  | @ -17,7 +17,7 @@ extern int parse_tag_buffer(struct tag *item, const void *data, unsigned long si | ||||||
| extern int parse_tag(struct tag *item); | extern int parse_tag(struct tag *item); | ||||||
| extern struct object *deref_tag(struct object *, const char *, int); | extern struct object *deref_tag(struct object *, const char *, int); | ||||||
| extern struct object *deref_tag_noverify(struct object *); | extern struct object *deref_tag_noverify(struct object *); | ||||||
| extern int gpg_verify_tag(const unsigned char *sha1, | extern int gpg_verify_tag(const struct object_id *oid, | ||||||
| 		const char *name_to_report, unsigned flags); | 		const char *name_to_report, unsigned flags); | ||||||
|  |  | ||||||
| #endif /* TAG_H */ | #endif /* TAG_H */ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Stefan Beller
						Stefan Beller