git-2.22.0/log-tree.c
/*
 * Do we have HEAD in the output, and also the branch it points at?
 * If so, find that decoration entry for that current branch.
 */
Do we have HEAD in the output, and also the branch it points at.
If so, find that decoration entry for that current branch.
Do we have HEAD in the output and also the branch it points at . If so find that decoration entry for that current branch .
static const struct name_decoration *current_pointed_by_HEAD(const struct name_decoration *decoration)
{
	const struct name_decoration *list, *head = NULL;
	const char *branch_name = NULL;
	int rru_flags;
	for (list = decoration; list; list = list->next)
		if (list->type == DECORATION_REF_HEAD) {
			head = list;
			break;
		}
	if (!head)
		return NULL;
	branch_name = resolve_ref_unsafe("HEAD", 0, NULL, &rru_flags);
	if (!branch_name || !(rru_flags & REF_ISSYMREF))
		return NULL;
	if (!starts_with(branch_name, "refs/"))
		return NULL;
	for (list = decoration; list; list = list->next)
		if ((list->type == DECORATION_REF_LOCAL) &&
		    !strcmp(branch_name, list->name)) {
			return list;
		}
	return NULL;
}
static const struct name_decoration * current_pointed_by_HEAD ( const struct name_decoration * decoration ) { const struct name_decoration * list , * head = NULL ; const char * branch_name = NULL ; int rru_flags ; for ( list = decoration ; list ; list = list -> next ) if ( list -> type == DECORATION_REF_HEAD ) { head = list ; break ; } if ( ! head ) return NULL ; branch_name = resolve_ref_unsafe ( " " , 0 , NULL , & rru_flags ) ; if ( ! branch_name || ! ( rru_flags & REF_ISSYMREF ) ) return NULL ; if ( ! starts_with ( branch_name , " " ) ) return NULL ; for ( list = decoration ; list ; list = list -> next ) if ( ( list -> type == DECORATION_REF_LOCAL ) && ! strcmp ( branch_name , list -> name ) ) { return list ; } return NULL ; }
Do we have HEAD in the output, and also the branch it points at?
Do we have HEAD in the output and also the branch it points at?
/* First find HEAD */ /* Now resolve and find the matching current branch */ /* OK, do we have that ref in the list? */