コード例 #1
0
ファイル: fmt-merge-msg.c プロジェクト: CCorreia/git
static void add_people_count(struct strbuf *out, struct string_list *people)
{
	if (people->nr == 1)
		strbuf_addf(out, "%s", people->items[0].string);
	else if (people->nr == 2)
		strbuf_addf(out, "%s (%d) and %s (%d)",
			    people->items[0].string,
			    (int)util_as_integral(&people->items[0]),
			    people->items[1].string,
			    (int)util_as_integral(&people->items[1]));
	else if (people->nr)
		strbuf_addf(out, "%s (%d) and others",
			    people->items[0].string,
			    (int)util_as_integral(&people->items[0]));
}
コード例 #2
0
ファイル: fmt-merge-msg.c プロジェクト: CCorreia/git
static void record_person(int which, struct string_list *people,
			  struct commit *commit)
{
	char name_buf[MAX_GITNAME], *name, *name_end;
	struct string_list_item *elem;
	const char *field = (which == 'a') ? "\nauthor " : "\ncommitter ";

	name = strstr(commit->buffer, field);
	if (!name)
		return;
	name += strlen(field);
	name_end = strchrnul(name, '<');
	if (*name_end)
		name_end--;
	while (isspace(*name_end) && name <= name_end)
		name_end--;
	if (name_end < name || name + MAX_GITNAME <= name_end)
		return;
	memcpy(name_buf, name, name_end - name + 1);
	name_buf[name_end - name + 1] = '\0';

	elem = string_list_lookup(people, name_buf);
	if (!elem) {
		elem = string_list_insert(people, name_buf);
		elem->util = (void *)0;
	}
	elem->util = (void*)(util_as_integral(elem) + 1);
}
コード例 #3
0
ファイル: fmt-merge-msg.c プロジェクト: H1ghT0p/git
static void record_person(int which, struct string_list *people,
			  struct commit *commit)
{
	const char *buffer;
	char *name_buf, *name, *name_end;
	struct string_list_item *elem;
	const char *field;

	field = (which == 'a') ? "\nauthor " : "\ncommitter ";
	buffer = get_commit_buffer(commit, NULL);
	name = strstr(buffer, field);
	if (!name)
		return;
	name += strlen(field);
	name_end = strchrnul(name, '<');
	if (*name_end)
		name_end--;
	while (isspace(*name_end) && name <= name_end)
		name_end--;
	if (name_end < name)
		return;
	name_buf = xmemdupz(name, name_end - name + 1);
	unuse_commit_buffer(commit, buffer);

	elem = string_list_lookup(people, name_buf);
	if (!elem) {
		elem = string_list_insert(people, name_buf);
		elem->util = (void *)0;
	}
	elem->util = (void*)(util_as_integral(elem) + 1);
	free(name_buf);
}
コード例 #4
0
ファイル: fmt-merge-msg.c プロジェクト: CCorreia/git
static int cmp_string_list_util_as_integral(const void *a_, const void *b_)
{
	const struct string_list_item *a = a_, *b = b_;
	return util_as_integral(b) - util_as_integral(a);
}