<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>C &#8211; HU Xiaoxu</title>
	<atom:link href="https://blog.ihuxu.com/tag/c/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.ihuxu.com</link>
	<description>a software engineer&#039;s blog</description>
	<lastBuildDate>Wed, 18 Jun 2025 15:26:21 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.2</generator>
	<item>
		<title>基于 libgit2 C 语言库的 php-git 扩展 fix bug 辛酸史</title>
		<link>https://blog.ihuxu.com/the-experience-of-the-fixing-libgit2-git-diff-tree-to-tree-bug/</link>
					<comments>https://blog.ihuxu.com/the-experience-of-the-fixing-libgit2-git-diff-tree-to-tree-bug/#comments</comments>
		
		<dc:creator><![CDATA[HU Xiaoxu]]></dc:creator>
		<pubDate>Sat, 27 Aug 2016 09:41:31 +0000</pubDate>
				<category><![CDATA[Computer Language]]></category>
		<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Dev Problem]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Original]]></category>
		<category><![CDATA[PHP Extension]]></category>
		<guid isPermaLink="false">http://www.ihuxu.com/blog/?p=1181</guid>

					<description><![CDATA[前言 这是一篇极其没有节（nei）操（rong）的文章。除非你真的无聊，请不要阅读，否则后果自负~ 正文 最近，在忙活微博话题组的日构建工具。工具主要的功能并不算复杂。写着写着，外面雨过天晴，居然还放起爆竹了，什么鬼。 构建工具的主要功能正如介绍中所述的那样，提取产品、测试等基本信息、提取版本库（git）信息、检查（编译）源文件、自动部署项目与发送邮件等。在提取 git 库信息时，相对于之前利用 shell_exec PHP 原生函数提取 svn 信息的方式，打算利用扩展来提取信息。一来更规范、更有效率（微乎其微），二来专业。缺点是相对而言部署环境麻烦，因为需要安装 git 扩展到当前 php 运行环境中来。 但是，万万没想到官方推荐的 php-git 扩展库开发版本已有3年没有维护了。索性用吧，又能怎样。 安装 还算顺利，由于公司开发机没有 cmake，yum 源也不可用，懒得配置，直接 download 一套源码。 上述步骤自行领会，注意上述适用于 64 位 Linux 系统，32 位的 Linux 请见上述提到的 php-git 库说明文档。 使用 我们提取的 git 信息基本也就是从上一次部署版本，到该次部署版本之间的 log 和 diff 信息。所以，第一件事情，就是拿到这段的 commit hash 值。关于下文中提到的 commit hash 和 tree hash 概念可以自行 google 或参见博客libgit2使用教程（特别篇）几个基本概念说明。 在拿到 commit hash 之后，将通过 git_diff_tree_to_tree 方法拿到每个 commit hash 之间的 diff 信息。通过方法名可以知道，这个 diff 信息是通过两个 tree 拿到的。 调用代码：<div class="read-more"><a class="btn read-more-btn" href="https://blog.ihuxu.com/the-experience-of-the-fixing-libgit2-git-diff-tree-to-tree-bug/">Read More</a></div>]]></description>
		
					<wfw:commentRss>https://blog.ihuxu.com/the-experience-of-the-fixing-libgit2-git-diff-tree-to-tree-bug/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
