예제 #1
0
int addto_map_each_ref_fn(const char *refname, const unsigned char *sha1, int /*flags*/, void *cb_data)
{
	MAP_HASH_NAME *map = (MAP_HASH_NAME*)cb_data;
	CString str;
	g_Git.StringAppend(&str, (BYTE*)refname, CP_UTF8);
	CGitHash hash((char*)sha1);

	(*map)[hash].push_back(str);

	if(strncmp(refname, "refs/tags", 9) == 0)
	{
		try
		{
			GIT_HASH refhash;
			if(!git_deref_tag(sha1, refhash))
			{
				(*map)[(char*)refhash].push_back(str+_T("^{}"));
			}
		}
		catch (char* msg)
		{
			CString err(msg);
			::MessageBox(NULL, _T("Could not get (readable) reference for hash ") + hash.ToString() + _T(".\nlibgit reports:\n") + err, _T("TortoiseGit"), MB_ICONERROR);
		}
	}
	return 0;
}
예제 #2
0
int addto_list_each_ref_fn(const char *refname, const unsigned char * /*sha1*/, int /*flags*/, void *cb_data)
{
	STRING_VECTOR *list = (STRING_VECTOR*)cb_data;
	CString str;
	g_Git.StringAppend(&str, (BYTE*)refname, CP_UTF8);
	list->push_back(str);
	return 0;
}