ref-filter: convert grab_objectname to struct object_id
This is necessary in order to convert find_unique_abbrev. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
		 brian m. carlson
					brian m. carlson
				
			
				
					committed by
					
						 Junio C Hamano
						Junio C Hamano
					
				
			
			
				
	
			
			
			 Junio C Hamano
						Junio C Hamano
					
				
			
						parent
						
							df46d77e00
						
					
				
				
					commit
					1776979573
				
			
							
								
								
									
										12
									
								
								ref-filter.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								ref-filter.c
									
									
									
									
									
								
							| @ -737,18 +737,18 @@ static void *get_obj(const struct object_id *oid, struct object **obj, unsigned | |||||||
| 	return buf; | 	return buf; | ||||||
| } | } | ||||||
|  |  | ||||||
| static int grab_objectname(const char *name, const unsigned char *sha1, | static int grab_objectname(const char *name, const struct object_id *oid, | ||||||
| 			   struct atom_value *v, struct used_atom *atom) | 			   struct atom_value *v, struct used_atom *atom) | ||||||
| { | { | ||||||
| 	if (starts_with(name, "objectname")) { | 	if (starts_with(name, "objectname")) { | ||||||
| 		if (atom->u.objectname.option == O_SHORT) { | 		if (atom->u.objectname.option == O_SHORT) { | ||||||
| 			v->s = xstrdup(find_unique_abbrev(sha1, DEFAULT_ABBREV)); | 			v->s = xstrdup(find_unique_abbrev(oid->hash, DEFAULT_ABBREV)); | ||||||
| 			return 1; | 			return 1; | ||||||
| 		} else if (atom->u.objectname.option == O_FULL) { | 		} else if (atom->u.objectname.option == O_FULL) { | ||||||
| 			v->s = xstrdup(sha1_to_hex(sha1)); | 			v->s = xstrdup(oid_to_hex(oid)); | ||||||
| 			return 1; | 			return 1; | ||||||
| 		} else if (atom->u.objectname.option == O_LENGTH) { | 		} else if (atom->u.objectname.option == O_LENGTH) { | ||||||
| 			v->s = xstrdup(find_unique_abbrev(sha1, atom->u.objectname.length)); | 			v->s = xstrdup(find_unique_abbrev(oid->hash, atom->u.objectname.length)); | ||||||
| 			return 1; | 			return 1; | ||||||
| 		} else | 		} else | ||||||
| 			die("BUG: unknown %%(objectname) option"); | 			die("BUG: unknown %%(objectname) option"); | ||||||
| @ -775,7 +775,7 @@ static void grab_common_values(struct atom_value *val, int deref, struct object | |||||||
| 			v->s = xstrfmt("%lu", sz); | 			v->s = xstrfmt("%lu", sz); | ||||||
| 		} | 		} | ||||||
| 		else if (deref) | 		else if (deref) | ||||||
| 			grab_objectname(name, obj->oid.hash, v, &used_atom[i]); | 			grab_objectname(name, &obj->oid, v, &used_atom[i]); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| @ -1455,7 +1455,7 @@ static void populate_value(struct ref_array_item *ref) | |||||||
| 				v->s = xstrdup(buf + 1); | 				v->s = xstrdup(buf + 1); | ||||||
| 			} | 			} | ||||||
| 			continue; | 			continue; | ||||||
| 		} else if (!deref && grab_objectname(name, ref->objectname.hash, v, atom)) { | 		} else if (!deref && grab_objectname(name, &ref->objectname, v, atom)) { | ||||||
| 			continue; | 			continue; | ||||||
| 		} else if (!strcmp(name, "HEAD")) { | 		} else if (!strcmp(name, "HEAD")) { | ||||||
| 			if (atom->u.head && !strcmp(ref->refname, atom->u.head)) | 			if (atom->u.head && !strcmp(ref->refname, atom->u.head)) | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user