move load_ref_decorations() to log-tree.c and export it
log-tree.c is the ideal place for load_ref_decorations() and its helper functions to live in, because the variable name_decoration they're operating on is already located there, so move them thither. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
		 René Scharfe
					René Scharfe
				
			
				
					committed by
					
						 Junio C Hamano
						Junio C Hamano
					
				
			
			
				
	
			
			
			 Junio C Hamano
						Junio C Hamano
					
				
			
						parent
						
							5e9bf11c1a
						
					
				
				
					commit
					cab4feb67d
				
			| @ -14,7 +14,6 @@ | ||||
| #include "tag.h" | ||||
| #include "reflog-walk.h" | ||||
| #include "patch-ids.h" | ||||
| #include "refs.h" | ||||
| #include "run-command.h" | ||||
| #include "shortlog.h" | ||||
|  | ||||
| @ -25,40 +24,6 @@ static int default_show_root = 1; | ||||
| static const char *fmt_patch_subject_prefix = "PATCH"; | ||||
| static const char *fmt_pretty; | ||||
|  | ||||
| static void add_name_decoration(const char *prefix, const char *name, struct object *obj) | ||||
| { | ||||
| 	int plen = strlen(prefix); | ||||
| 	int nlen = strlen(name); | ||||
| 	struct name_decoration *res = xmalloc(sizeof(struct name_decoration) + plen + nlen); | ||||
| 	memcpy(res->name, prefix, plen); | ||||
| 	memcpy(res->name + plen, name, nlen + 1); | ||||
| 	res->next = add_decoration(&name_decoration, obj, res); | ||||
| } | ||||
|  | ||||
| static int add_ref_decoration(const char *refname, const unsigned char *sha1, int flags, void *cb_data) | ||||
| { | ||||
| 	struct object *obj = parse_object(sha1); | ||||
| 	if (!obj) | ||||
| 		return 0; | ||||
| 	add_name_decoration("", refname, obj); | ||||
| 	while (obj->type == OBJ_TAG) { | ||||
| 		obj = ((struct tag *)obj)->tagged; | ||||
| 		if (!obj) | ||||
| 			break; | ||||
| 		add_name_decoration("tag: ", refname, obj); | ||||
| 	} | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| void load_ref_decorations(void) | ||||
| { | ||||
| 	static int loaded; | ||||
| 	if (!loaded) { | ||||
| 		loaded = 1; | ||||
| 		for_each_ref(add_ref_decoration, NULL); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| static void cmd_log_init(int argc, const char **argv, const char *prefix, | ||||
| 		      struct rev_info *rev) | ||||
| { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user