<?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>xiphux &#187; gitphp</title>
	<atom:link href="http://www.xiphux.com/tag/gitphp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xiphux.com</link>
	<description></description>
	<lastBuildDate>Sat, 28 Jan 2012 17:05:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>GitPHP 0.2.6</title>
		<link>http://www.xiphux.com/2012/01/28/gitphp-0-2-6/?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://www.xiphux.com/2012/01/28/gitphp-0-2-6/#comments</comments>
		<pubDate>Sat, 28 Jan 2012 17:05:18 +0000</pubDate>
		<dc:creator>xiphux</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[gitphp]]></category>

		<guid isPermaLink="false">http://www.xiphux.com/?p=905</guid>
		<description><![CDATA[I&#8217;ve released GitPHP 0.2.6. This release has more internal changes than end-user ones, but there are still a few enhancements and fixes for users and administrators. Enhancements: Upgrade to Smarty 3. Some templates have been reorganized to take advantage of Smarty 3&#8242;s hierarchical template features RequireJS is now used to serve javascript. RequireJS is a ]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve released GitPHP 0.2.6.  This release has more internal changes than end-user ones, but there are still a few enhancements and fixes for users and administrators.</p>
<ul>
<li><strong>Enhancements:</strong>
<ul>
<li>Upgrade to <a href="http://smarty.net">Smarty 3</a>.  Some templates have been reorganized to take advantage of Smarty 3&#8242;s hierarchical template features</li>
<li><a href="http://requirejs.org/" title="RequireJS">RequireJS</a> is now used to serve javascript.  RequireJS is a module loader that has allowed me to restructure the javascript code into clean reusable modules.  My javascript code before was&#8230; let&#8217;s just say gross.  Using RequireJS does have some other benefits too:
<ul>
<li>RequireJS loads modules asynchronously and in parallel.  Many browsers still load javascript files from the web server one at a time, blocking each load until the previous one has finished loading.  This improves page load time.</li>
<li>The RequireJS javascript minification process (which I do for all packaged releases) will combine all modules for a page and their dependencies into a single file before compression, which reduces the number of separate files the user&#8217;s browser has to load.</li>
</ul>
</li>
<li>GitPHP can now read project-specific config options from the git config in the repository directory itself (e.g. gitphp.git/config), to allow project-specific settings to carry across multiple gitphp installations.  This file can be edited directly or accessed using the &#8216;git config&#8217; command.  The section is [gitphp], and the config values are each of the project specific settings currently supported in projects.conf.php.  See the comments in projects.conf.php.example for more information.  The project-specific config file will override global gitphp settings in gitphp.conf.php, but install-specific settings in projects.conf.php will override the project-specific config file.</li>
<li>GitPHP can now use the <a href="http://code.google.com/apis/libraries/" title="Google Libraries API">Google Libraries API</a> to serve the jQuery library, by setting the &#8216;googlejs&#8217; config value.  Using the Google Libraries API allows you to offload serving that library from your web server, and allows users to benefit from a single cached file for all sites using the Google Libraries API.  The library is served from Google&#8217;s servers, which means this won&#8217;t work if you&#8217;re running on an intranet without outside internet access.</li>
<li>Signed-off-by lines in commit messages and PGP blocks in tags are styled differently to differentiate them from the actual commit/tag message</li>
<li>The shortlog now displays abbreviated hashes for each commit.  The abbreviation length is read from the project&#8217;s git config file (core.abbrev setting), defaulting to 7.  By default, abbreviated hashes are not checked for collisions.  A gitphp config setting, &#8216;uniqueabbrev&#8217;, has been added which will turn on collision checking when abbreviating hashes.  Note that this is performance intensive because it needs to search every hash in the project, which is why it&#8217;s off by default.  You might be better served just increasing the minimum abbreviation length.</li>
<li>Japanese translation, thanks to Ishikawa Mutsumi</li>
</ul>
</li>
<li><strong>Fixes:</strong>
<ul>
<li>Fix a collision when multiple users were downloading an uncached version of the exact same snapshot at the exact same time</li>
<li>Fix direct line links on non-GeSHi blob pages, thanks to Steve Clay</li>
<li>Fix order of shortlog/log commits when a branch is rebased</li>
<li>Fix trimming of multibyte commit messages in shortlog, thanks to Ishikawa Mutsumi</li>
<li>Fix handling of git&#8217;s commit encoding header in commit messages</li>
<li>Fix handling of non-ASCII filenames in tree view.  Based on a fix by sh2ka</li>
<li>Re-enable whitespace trimming to decrease the size of HTML files served.  Was accidentally disabled during the big rewrite a year ago</li>
<li>Fix a potential XSS vulnerability</li>
</ul>
</li>
</ul>
<p>Smarty 3 was a difficult transition that&#8217;s been in the works for a long time.  Smarty 3 was a complete rewrite from smarty 2 &#8211; and as I certainly found out during my big GitPHP rewrite, a complete rewrite tends to introduce slight unintentional functional changes.  And for Smarty, as a library, those slight functional changes manifest themselves as bugs in the consuming app.  I&#8217;ve spent a long time hunting Smarty 3 bugs in GitPHP using every single possible configuration combination I could think of.  I believe I&#8217;ve gotten all the ones I can find, but I can&#8217;t possibly reproduce every single setup and git repo out there &#8211; so if you run into issues, by all means let me know.</p>
<p><strong>Smarty 2&#8242;s compiled templates and cached files are incompatible with Smarty 3, so for safety I would suggest deleting the compiled templates in the template_c/ directory, any cached files in the cache/ directory, and bouncing Memcache if you use it.</strong>  Smarty 3&#8242;s template compilation takes longer than before due to the hierarchical templates, however this will only happen the first time a page is loaded after deleting the contents of templates_c, you won&#8217;t have to do it again.</p>
<p>The release is on the <a href="http://www.xiphux.com/programming/gitphp/">GitPHP page</a> and bugs can be filed on <a href="http://mantis.xiphux.com">the bugtracker</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiphux.com/2012/01/28/gitphp-0-2-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GitPHP 0.2.5</title>
		<link>http://www.xiphux.com/2011/08/27/gitphp-0-2-5/?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://www.xiphux.com/2011/08/27/gitphp-0-2-5/#comments</comments>
		<pubDate>Sat, 27 Aug 2011 22:16:13 +0000</pubDate>
		<dc:creator>xiphux</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[gitphp]]></category>

		<guid isPermaLink="false">http://www.xiphux.com/?p=893</guid>
		<description><![CDATA[I&#8217;ve released GitPHP 0.2.5. I&#8217;ve had a little more free time recently than I&#8217;ve had for the past couple versions, so this version has some more changes than the previous couple releases. Enhancements: Move a lot of the data loading to using raw php file parsing instead of relying on the git executable. This causes ]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve released GitPHP 0.2.5.  I&#8217;ve had a little more free time recently than I&#8217;ve had for the past couple versions, so this version has some more changes than the previous couple releases.</p>
<ul>
<li><strong>Enhancements:</strong>
<ul>
<li>Move a lot of the data loading to using raw php file parsing instead of relying on the git executable.  This causes an enormous performance boost, especially on webservers that have very expensive process forking (I&#8217;m looking at you Apache)</li>
<li>Add a &#8216;compat&#8217; config option that can be specified globally or per-project, to fall back on the old method of loading data if you run into issues with the previous enhancement.  (PHP will not process repository packfiles larger than 2GB)</li>
<li>Add a &#8216;largeskip&#8217; config option.  Using raw PHP data loading, we have to walk commits down the log as you page down earlier and earlier in the history, which has decreasing performance as you go back.  This determines at what threshold gitphp will instead just use the git executable.
<li>Display merge commits in the shortlog with grayed-out titles, thanks to Tanguy Pruvot</li>
<li>Subdirectory snapshots now include the subdirectory as part of the archive name</li>
<li>Support for the <a href="http://pecl.php.net/package/xdiff">xdiff php extension</a>.  If you have the xdiff php extension installed, that will be used for diffing, which is faster and completely eliminates the need to have a separate diff executable or temp dir configured.</li>
<li>Support for loading the project list from an <a href="http://www.scm-manager.org/">SCM-Manager</a> config.  Only projects marked public are loaded.  Based on work done by Craig Sparks</li>
<li>Add debug info when searching directory for projects.  If you aren&#8217;t seeing certain or any projects appear when letting GitPHP find all projects in the project root, turn on the &#8216;debug&#8217; config option to see more about what it&#8217;s doing.</li>
<li>Benchmarking info is now turned on separately from debug info, with a new config option &#8216;benchmark&#8217;</li>
<li>Cache list of projects if the object cache is turned on, instead of searching the project root every time.  Based on work done by Tanguy Pruvot</li>
<li>Archives are now delivered incrementally to the user&#8217;s browser, instead of being loaded entirely into memory first.  This avoids PHP out-of-memory errors when trying to snapshot a very large project.  Note: as a result of this change, snapshot tarballs are no longer cached to Memcache, even if Memcache support is turned on.  They will always be cached to the cache directory on disk.</li>
<li>Minify CSS for performance</li>
<li>Support tags pointing directly to blobs.  This isn&#8217;t commonly done but can be used to embed something like a GPG key in a repository</li>
<li>Allow displaying a website URL for a project.  Because this can&#8217;t really be automatically calculated the way clone/push urls can, this is a per-project setting only.</li>
</ul>
</li>
<li><strong>Fixes:</strong>
<ul>
<li>Fixed how the default diff executable is determined if not specified in the config</li>
<li>Fixed issues diffing when the temp dir had spaces in the name (common on Windows)</li>
<li>Fixed issues diffing on windows when the temp dir didn&#8217;t have a trailing backslash</li>
<li>Avoid floods of warning messages when the fileinfo magic database is incorrectly compiled</li>
<li>Avoid warning messages when the project doesn&#8217;t have a description file.  (sometimes happens with repositories created by third party software other than the standard git program)</li>
<li>Fixed some display issues on the project list with owner/age/links columns wrapping too much when the project has an extremely long description</li>
<li>Avoid warning messages when listing all projects in the projectroot and the webserver user doesn&#8217;t have read access to one of the directories.  Based on a fix by Justyn Shull</li>
<li>Fixed issue where using the diff link by a single file on the commit page showed the wrong commit at the top of the diff</li>
</ul>
</li>
</ul>
<p>As always, the release is on the <a href="http://www.xiphux.com/programming/gitphp/">GitPHP page</a> and bugs can be filed on <a href="http://mantis.xiphux.com">the bugtracker</a>.  If you need support you can always <a href="mailto:xiphux@gmail.com">email me</a>, or if you would prefer a more public discussion, you can use the <a href="http://forums.xiphux.com">forums</a>.</p>
<p><strong>Q: You&#8217;ve had a smarty 3 branch in progress for a while now.  Why haven&#8217;t you merged it yet? Smarty 3 is perfect and amazing!!!1!eleven1one</strong><br />
<strong>A:</strong> Not quite.  Smarty 3 is a complete rewrite and, just like the complete GitPHP rewrite a year ago, has some bugs and some differences in behavior.  These changes in smarty 3 actually broke some of the functionality in GitPHP.  I&#8217;ve been making changes to accomodate new behavior, and doing hacks to work around smarty 3 bugs, and I&#8217;m still not convinced I&#8217;ve found all of them yet.  Additionally, Smarty 3&#8242;s cache infrastructure is completely different from Smarty 2, which renders all custom cache code useless.  In particular, this means that GitPHP Memcache support does not work at all with Smarty 3.  The upgrade to smarty 3 is something that makes development easier but has no real discernible effect for end users.  I refuse to do an &#8216;upgrade&#8217; that will negatively impact end users, especially when that negative impact is lost functionality.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiphux.com/2011/08/27/gitphp-0-2-5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Decreasing use of the git exe in GitPHP</title>
		<link>http://www.xiphux.com/2011/07/11/decreasing-use-of-the-git-exe-in-gitphp/?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://www.xiphux.com/2011/07/11/decreasing-use-of-the-git-exe-in-gitphp/#comments</comments>
		<pubDate>Tue, 12 Jul 2011 02:56:55 +0000</pubDate>
		<dc:creator>xiphux</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[gitphp]]></category>

		<guid isPermaLink="false">http://www.xiphux.com/?p=839</guid>
		<description><![CDATA[I&#8217;m actually not getting screwed by work this month, so I have a branch I&#8217;m working on where I&#8217;m changing the way GitPHP loads data from a project.  I&#8217;m moving as much of the data loading as possible into php itself, by having PHP directly access the objects and packfiles in the git project, rather ]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m actually not getting screwed by work this month, so I have a branch I&#8217;m working on where I&#8217;m changing the way GitPHP loads data from a project.  I&#8217;m moving as much of the data loading as possible into php itself, by having PHP directly access the objects and packfiles in the git project, rather than relying on calls to the git executable.  The packfile loading code is based off of <a href="http://github.com/patrikf/glip">Glip</a>, but these changes are not actually using the Glip library itself.</p>
<p>The majority of the work is done.  I&#8217;m going to be merging it into master relatively soon, with the intent of including the changes in the next release.  Since this is such a fundamental change to the way data is loaded, I&#8217;m providing a configuration option to fall back to using the git executable (like GitPHP has always done) in case there are issues, and I&#8217;m considering providing this option on a per-project basis.</p>
<p><strong>Update 7/17:</strong> This is merged into master.  Any beta testers willing to test the new loading code on their repositories by running from git master would be appreciated&#8230; maybe we can knock out any major compatibility issues early.</p>
<p><strong>Q: Why?</strong><br />
A: Several reasons:</p>
<ol>
<li>Compatibility.  The less calls I have to do to the shell, the less I have to worry about the differences between Linux and Windows, and breaking one or the other (usually Windows, since I develop on Linux)</li>
<li>Performance.  Every shell execution is a fork() off of the webserver&#8217;s process.  When you run lots of shell commands one after another, fork()-ing the web server process each time, the delay is noticeable.</li>
<li>Security.  While the good security practice would be to make your git repositories read-only to the webserver user, I bet very few people actually do that.  Passing user input down to a shell command is always a dangerous thing to do, and potentially exposes your server to hackers.  Unfortunately, I&#8217;ve always put functionality above security when calling the git executable, and I&#8217;d like to change that.</li>
</ol>
<p><strong>Q: Why didn&#8217;t you use Glip?</strong><br />
A. I experimented with using Glip.  In doing so, I found a couple things:</p>
<ol>
<li>Glip is incomplete.  It doesn&#8217;t load all of the objects that can exist in a git project, and is also missing a number of features I would need for it to replace the git executable.</li>
<li>Glip provides its own API to access objects in a git project &#8211; Blob, Commit, Tree, etc.  These objects were very similar to the git object representations I had created for GitPHP, but the API was different enough to make them incompatible.  In loading data using Glip, I found myself creating Glip objects, manually picking out values off of the properties just to stuff them into my own properties, and discarding the Glip objects.  Not only that, but the way it stored data in properties was different enough from my git objects that I ended up having to do redundant conversions.  Glip would load data in git&#8217;s internal representation, convert them to php&#8217;s internal representation, and then I would extract those values and convert them back into git&#8217;s internal representation for use in my objects.  It just felt like a really redundant amount of glue code.  I have no doubt that Glip would be great if you were writing a project from scratch based off it, but ripping apart and rewriting all of GitPHP&#8217;s model code is not something I&#8217;m looking to do anytime soon.</li>
</ol>
<p><strong>Q: Does this mean the git executable is no longer required?</strong><br />
A: Right now the git exe is still required.</p>
<p><strong>Q: Does this mean we may not need the git executable in the future?</strong><br />
A. I don&#8217;t want to say never, but this is unlikely.  While loading data from plain git objects is significantly faster in raw PHP, this also means that the processing has to be done in PHP.  There are a number of cases where large amounts of processing in PHP actually make it slower than just biting the bullet and calling the git executable:</p>
<ol>
<li>The git rev-list command (used for the shortlog/log) has a &#8211;skip command, which is used to skip a certain number of commits down in the log.  This is used for the next/prev paging in the log in GitPHP.  In raw PHP, we don&#8217;t have this option &#8211; we have to walk all the way down the commit log ourselves.  So in PHP, if you want to get page 5 of the log (commits 401-500), you have to walk the log and load commits 1-500, and discard the first 400.  So you can imagine that it gets really slow when you get down to page 21, and you have to load the first 2100 commits and discard the first 2000.  And walking the log isn&#8217;t just following each parent link &#8211; it&#8217;s any commit <em>reachable</em> from the tip, which includes all merged branches and any of their reachable commits.  The current implementation actually uses raw php for the early pages of the log, but when skipping a significant number of commits, falls back on the git executable in order to keep performance reasonable.</li>
<li>Searching for a commit, committer, or author requires loading every single commit in the history.</li>
<li>Grepping inside files requires loading up the contents of every single file in a tree and searching every line.</li>
<li>Getting the history of a file requires reading every single commit in the entire history and reading each commit&#8217;s tree to see if it touched this file.  That also doesn&#8217;t take into account things like detecting renames.</li>
<li>Getting the blame of a file requires getting the entire history of a file and diffing every commit with its parent to figure out the changes to the file.</li>
<li>Diffing a file would require me to write my own diff algorithm (non-trivial), or requiring an external php extension like xdiff, which I don&#8217;t want to do.</li>
</ol>
<p><strong>Q: Are there any additional requirements?</strong><br />
A: You&#8217;ll need <a href="http://us2.php.net/manual/en/book.zlib.php">Zlib</a> support in your PHP, since git objects are gz-compressed.</p>
<p><strong>Q: Are there any limitations?</strong><br />
A. The new loading code won&#8217;t read packfiles larger than 2GB.  This is a limitation in Glip, too.  It&#8217;s because php&#8217;s fseek() (or actually most operations in php) top out at 2GB (2*1024^3).</p>
<p>I&#8217;ll update this post with any other FAQs I can think of.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiphux.com/2011/07/11/decreasing-use-of-the-git-exe-in-gitphp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GitPHP 0.2.4</title>
		<link>http://www.xiphux.com/2011/06/24/gitphp-0-2-4/?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://www.xiphux.com/2011/06/24/gitphp-0-2-4/#comments</comments>
		<pubDate>Sat, 25 Jun 2011 01:58:35 +0000</pubDate>
		<dc:creator>xiphux</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[gitphp]]></category>

		<guid isPermaLink="false">http://www.xiphux.com/?p=832</guid>
		<description><![CDATA[GitPHP 0.2.4 is out. I&#8217;ve still been pretty busy, I apologize. Chinese translation &#8211; thanks to seefan Side-by-side diffs for blobdiff and commitdiff &#8211; based on work by Mattias Ulbrich and Tanguy Pruvot Fix clone and push urls using ssh colon notation &#8211; thanks to mdevilz Allow specifying hashbases by branch/tag name in URLs &#8211; ]]></description>
			<content:encoded><![CDATA[<p>GitPHP 0.2.4 is out.  I&#8217;ve still been pretty busy, I apologize.</p>
<ul>
<li><strong>Chinese translation</strong> &#8211; thanks to seefan</li>
<li><strong>Side-by-side diffs for blobdiff and commitdiff</strong> &#8211; based on work by Mattias Ulbrich and Tanguy Pruvot</li>
<li><strong>Fix clone and push urls using ssh colon notation</strong> &#8211; thanks to mdevilz</li>
<li><strong>Allow specifying hashbases by branch/tag name in URLs</strong> &#8211; previously you were required to specify the entire ref name, eg hb=refs/heads/master.  Now you can just specify the head/tag name, eg hb=master.</li>
<li><strong>Fix crash in blobdiff_plain when specifying hashbase without a hash</strong> &#8211; this prevented you from using urls with just a filename and hashbase id or ref name, which was supposed to find the right file hash automatically</li>
</ul>
<p>Release is on the <a href="http://www.xiphux.com/programming/gitphp">GitPHP</a> page and bugs can be reported on the <a href="http://mantis.xiphux.com">bugtracker</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiphux.com/2011/06/24/gitphp-0-2-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GitPHP 0.2.3</title>
		<link>http://www.xiphux.com/2011/02/24/gitphp-0-2-3/?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://www.xiphux.com/2011/02/24/gitphp-0-2-3/#comments</comments>
		<pubDate>Fri, 25 Feb 2011 02:25:02 +0000</pubDate>
		<dc:creator>xiphux</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[gitphp]]></category>

		<guid isPermaLink="false">http://www.xiphux.com/?p=803</guid>
		<description><![CDATA[I&#8217;ve released GitPHP 0.2.3. Unfortunately I&#8217;ve had a pretty busy couple months at work, so I didn&#8217;t really get to any of the enhancements that I intended to get to this release. 0.2.3 has several bugfixes that I wanted to get out, rather than delaying the release and making you wait for them. Degrade gracefully ]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve released GitPHP 0.2.3.  Unfortunately I&#8217;ve had a pretty busy couple months at work, so I didn&#8217;t really get to any of the enhancements that I intended to get to this release.  0.2.3 has several bugfixes that I wanted to get out, rather than delaying the release and making you wait for them.</p>
<ul>
<li><strong>Degrade gracefully when the system doesn&#8217;t have posix functions</strong><br />Previously there was a bug where the page crashed when trying to display the project owner on systems without the php posix module installed (windows systems, and several linux distributions).  If you don&#8217;t have this module then the owner still won&#8217;t display unless you set the gitweb.owner config value or override it in projects.conf.php, but at least the page won&#8217;t stop rendering it.</li>
<li><strong>Make the language setting a permanent cookie</strong><br />Previously, the language cookie was a session cookie, so when you came back to the site you had to change your language again.  Now it&#8217;s a permanent cookie with a 1 year expiration.</li>
<li><strong>Escape HTML in the title header</strong><br />Previously, commit messages weren&#8217;t escaped in the title bar (the gray bar with the commit message at the top of the page, below the nav), so commit messages with HTML in them caused weird things to happen.  Now the HTML displays properly</li>
<li><strong>Add attribution and link back to GitPHP page in the footer</strong><br />This is by request, I swear.  If you don&#8217;t like it, I don&#8217;t mind if you delete it from the footer and go back to the old appearance.</li>
<li><strong>Run javascript project livesearch after the user stops typing</strong><br >Previously the javascript livesearch on the project list ran after every letter you typed.  This caused a severe performance hit on larger project lists, since the browser would churn through the huge list of projects many times in succession.  Now it runs after the user stops typing.</li>
<li><strong>Remove containing tag from object cache</strong><br />Previously an object&#8217;s containing tag was stored in the object cache.  The containing tag is actually not immutable data, and so there are certain cases where caching this would cause the display to get out of sync.  Now, this is no longer cached.  I would suggest clearing your cache after upgrading to be safe.</li>
<li><strong>Improve performance of projects with lots of tags or heads</strong><br />Previously there was a <strong>severe</strong> performance problem with projects with many tags or heads (hundreds).  This was because it was attempting to load all tags and all their data into memory.  For example, the git repo for the git program has almost 400 tags, and took almost 2 minutes to load any page.  Now, it only loads the data for the tags it needs so it&#8217;s a lot better.</li>
<li><strong>Clean up stylesheets</strong><br />Previously the stylesheet was a mess and was really difficult to read.  I&#8217;ve cleaned it up, organized it, and broken it out into two separate stylesheets &#8211; a functional stylesheet (gitphp.css) which contains declarations needed for gitphp to layout and work properly, and a look and feel stylesheet (gitphpskin.css) which customizes the colors and styling.  The stylesheet config option now controls the location of the skin stylesheet &#8211; so you can make a copy, customize the look and feel, and point the stylesheet config option at the new skin stylesheet.  The config option has backwards compatibility to handle the fact that the stylesheet name changed but people may have the option pointing at the old single stylesheet from previous example configs.</li>
</ul>
<p>As always, the release is available on the <a href="http://www.xiphux.com/programming/gitphp/">GitPHP page</a> and bugs can be reported on the <a href="http://mantis.xiphux.com">bugtracker</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiphux.com/2011/02/24/gitphp-0-2-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GitPHP 0.2.2</title>
		<link>http://www.xiphux.com/2010/12/12/gitphp-0-2-2/?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://www.xiphux.com/2010/12/12/gitphp-0-2-2/#comments</comments>
		<pubDate>Sun, 12 Dec 2010 21:46:04 +0000</pubDate>
		<dc:creator>xiphux</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[gitphp]]></category>

		<guid isPermaLink="false">http://www.xiphux.com/?p=796</guid>
		<description><![CDATA[I&#8217;ve released GitPHP 0.2.2. There are a number of neat enhancements in this release; you might have seen some running on the local copy on this site &#8211; javascript livesearch of the project list, ajax tree drilldown, choice of snapshot format, bugtracker linking, etc. Plus there are major enhancements on the backend, including the object ]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve released GitPHP 0.2.2.  There are a number of neat enhancements in this release; you might have seen some running on the local copy on this site &#8211; javascript livesearch of the project list, ajax tree drilldown, choice of snapshot format, bugtracker linking, etc.  Plus there are major enhancements on the backend, including the object cache described in a previous post, and built-in memcache support for all caching &#8211; just specify the memcache server(s) in the config and you&#8217;re good to go.</p>
<p>Full changelog:</p>
<ul>
<li>Enhancements:
<ul>
<li>Atom feed support, thanks to Christian Weiske</li>
<li>Error pages now return proper HTTP error codes to avoid search engine indexing</li>
<li>Users can now choose the file format of snapshot they want, based on what&#8217;s supported by the system.  The config value still controls the default for non-javascript users.</li>
<li>Directories in the config file no longer require you to specify the trailing slash</li>
<li>Overriding project settings (category, owner, description, clone url, etc) can now be done for all project listing methods &#8211; directory list, file list, and array list.  Previously it could only be done with the array</li>
<li>The tree view can now be drilled down using AJAX</li>
<li><a href="http://memcached.org/">Memcache</a> support</li>
<li>Support for linking bug numbers in commit messages to a bug tracker</li>
<li>Search box to search projects on the project list.  This is a live search if you have javascript</li>
<li>Object cache, for caching immutable git data &#8211; more info on what this is and why you want it is <a href="http://www.xiphux.com/2010/10/25/the-cache-strikes-back-the-gitphp-object-cache/">here</a></li>
<li>Javascript is now minified to decrease its size</li>
<li>Clone/push urls on the project page are now links, thanks to Cory Thomas</li>
<li>Project owners are now read from the git config value gitweb.owner if set, thanks to Cory Thomas</li>
</ul>
</li>
<li>Translations:
<ul>
<li>Russian, thanks to Aidsoid</li>
<li>German, thanks to Andy Tandler</li>
</ul>
</li>
<li>Bugfixes:
<ul>
<li>Fix issue where commit tooltips didn&#8217;t escape HTML characters correctly</li>
<li>Project ages on the project list page now use a more accurate method to get the age</li>
<li>The default tmpdir, if not specified in the config, is read from the system/php config rather than hardcoding it.  This also fixes an issue where the default tmpdir for windows was incorrect</li>
<li>Fix the default git binary for windows x64 installs</li>
<li>An error message now displays when the diff/git executable isn&#8217;t found or doesn&#8217;t work, rather than just failing silently</li>
</ul>
</li>
</ul>
<p>For those who are wondering about <a href="http://www.xiphux.com/2010/10/16/gitphp-project-array-format/">this post</a> about a backwards incompatible change &#8211; the change to specify overrides for all project list formats does change the project config file (projects.conf.php) format slightly, but the code is backwards compatible and will continue to use your old project config file until you adjust it for the new changes.</p>
<p>As always, the release can be downloaded from the <a href="http://www.xiphux.com/programming/gitphp/">gitphp page</a> and bugs can be reported on the <a href="http://mantis.xiphux.com/">bugtracker</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiphux.com/2010/12/12/gitphp-0-2-2/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>GitPHP phpDoc</title>
		<link>http://www.xiphux.com/2010/10/26/gitphp-phpdoc/?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://www.xiphux.com/2010/10/26/gitphp-phpdoc/#comments</comments>
		<pubDate>Wed, 27 Oct 2010 04:37:36 +0000</pubDate>
		<dc:creator>xiphux</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[gitphp]]></category>

		<guid isPermaLink="false">http://www.xiphux.com/?p=792</guid>
		<description><![CDATA[I&#8217;ve generated GitPHP&#8217;s API documentation using phpDoc. Most of the headers in the files come out with pretty good documentation; a few of them still need to be cleaned up. I&#8217;ll try to regenerate the documentation every now and then, but it may not always be 100% in sync with the code in the repository. ]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve generated GitPHP&#8217;s API documentation using <a href="http://www.phpdoc.org/">phpDoc</a>.  Most of the headers in the files come out with pretty good documentation; a few of them still need to be cleaned up.  I&#8217;ll try to regenerate the documentation every now and then, but it may not always be 100% in sync with the code in the repository.</p>
<p>It&#8217;s available at <a href="http://api.xiphux.com/gitphp">http://api.xiphux.com/gitphp</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiphux.com/2010/10/26/gitphp-phpdoc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The cache strikes back: The GitPHP object cache</title>
		<link>http://www.xiphux.com/2010/10/25/the-cache-strikes-back-the-gitphp-object-cache/?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://www.xiphux.com/2010/10/25/the-cache-strikes-back-the-gitphp-object-cache/#comments</comments>
		<pubDate>Mon, 25 Oct 2010 22:32:23 +0000</pubDate>
		<dc:creator>xiphux</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[gitphp]]></category>

		<guid isPermaLink="false">http://www.xiphux.com/?p=783</guid>
		<description><![CDATA[I&#8217;ve introduced a new caching feature in GitPHP: the object cache. The existing cache in GitPHP uses Smarty caching on a per-template basis. This means that each page has its own cache. However, each time that page needs to be regenerated, it hits the git repository for everything it needs. This meant there were lots ]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve introduced a new caching feature in GitPHP: the object cache.</p>
<p>The existing cache in GitPHP uses Smarty caching on a per-template basis.  This means that each page has its own cache.  However, each time that page needs to be regenerated, it hits the git repository for everything it needs.</p>
<p>This meant there were lots of places where effort was being duplicated, even with the cache turned on.  For example, if you visited the shortlog, you loaded up the data for 50 commits.  Ok.  Then you visited the log page, and you loaded up the data for the same 50 commits&#8230; that&#8217;s 50+ redundant git repository hits.  Another example is changing the language &#8211; various labels are different but the data is exactly the same, but it still needs to be loaded twice because the cached template is different.</p>
<p>Therefore, I created the object cache.  The object cache is a secondary layer of caching that <strong>only</strong> stores immutable data from git.  Because of git&#8217;s architecture as a directed acyclic graph, all of its content is stored as hashes of data.  This means that the contents of a hash &#8211; for example, a blob or a commit &#8211; will be exactly the same now as it will be weeks later.  So if we store this immutable data parsed and loaded in the cache, we can use it as many times as we want later, without hitting the git repository for it.</p>
<p>So continuing with the previous example, visiting the shortlog will first load up 50 commits from the repository.  (this is unavoidable)  Then, going to the log will hit the cache for those 50 commits and never hit the repository.</p>
<p>Because this is intended to only cache immutable git data, there are a number of things that it doesn&#8217;t cache.  For example, which commit is the HEAD isn&#8217;t cached, because that changes all the time.  Likewise, the blame or history of a blob isn&#8217;t cached, because that is technically mutable based on the filename used to refer to the blob.  (Because the same blob can represent more than one file).  Here&#8217;s the list of known immutable stuff that is cached:</p>
<ul>
<li>Commit &#8211; its author/committer/times, parent commit(s), comment, tree, containing tag</li>
<li>Tags &#8211; both light tags and tag objects, and the object they are tagging (commit or tag), and their message</li>
<li>Blob &#8211; the file contents</li>
<li>Tree &#8211; its contents (sub-trees and blobs)</li>
</ul>
<p>This option (&#8216;objectcache&#8217; in the config) is separate from the existing template cache option.  You can choose not to use it, while continuing to use template caching.  Or you can choose to only use the object cache without using the template cache, in order to eliminate most of the git repository calls while absolutely guaranteeing that you&#8217;re seeing the most up to date data.  Or you can use both together for the maximum benefit.  Combine that with the recently added <a href="http://www.memcached.org/">Memcache</a> support, and you&#8217;ve got yourself a pretty sweet setup.</p>
<p>The object cache also has its own lifetime setting (&#8216;objectcachelifetime&#8217; in the config).  Because the data cached in the object cache is immutable, it&#8217;s safe to set the object cache&#8217;s lifetime extremely high.  The default is 86400 seconds (24 hrs).</p>
<p>I&#8217;ve included some technical details of how this works below.  It&#8217;s a long read, but if you&#8217;re programming inclined, it&#8217;s worth checking out.  Part of it is because you will need to know some of this if you intend to make changes to GitPHP code.  Part of it is also because it was interesting to implement <img src='http://www.xiphux.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>Technical info</h2>
<h3>The Cache interface</h3>
<p>The object cache uses a wrapper interface around Smarty&#8217;s cache system to store arbitrary data.  This was done because I wanted to keep the cache interface the same for both the object cache and the template cache.  This meant that if the user was using the memcache smarty interface, then both caching methods would go to the same place.  Likewise, with disk caching, data is stored in the same place.  It&#8217;s simpler for the user and easier for me to maintain.</p>
<p>The cache system uses a single smarty template for storing all data.  The template does nothing but store and return a string of data, and each individual piece of data cached is distinguished by a unique cache id.  Data is stored serialized into a string and inserted into the template, and is retrieved by fetching the contents of that template and deserializing the data &#8211; so the template is never actually output.  This interface is in include/cache/Cache.class.php.  It is a bit of a hack, but I&#8217;ve already used this trick before to cache blob headers when viewing plaintext blobs.</p>
<h3>Loading/storing data</h3>
<p>Objects are all retrieved using a factory method off of the GitPHP_Project class in include/git/Project.class.php &#8211; GetCommit, GetTag, GetBlob, GetTree, etc.  The factories will return a deserialized cached object if it is found, otherwise a new instance of the object.  The objects save/update themselves in the cache after some data is loaded from the repository (ReadData in include/git/Commit.class.php, ReadData in include/git/Blob.class.php, etc).</p>
<h3>Serialization</h3>
<p>PHP objects have a magic function called __sleep that is called right before serialization.  This returns a list of properties to serialize.  In a lot of objects (such as Commit) this just returns all properties.  In the Blob object, because we don&#8217;t want to serialize the history/blame data (since that&#8217;s mutable data), we skip those properties.</p>
<p>However, the equivalent deserialization function __wakeup is <strong>not</strong> used.  This is because serializing object references in PHP introduced an interesting problem.</p>
<h3>Fucking references, how do <em>they</em> work?</h3>
<p>PHP will not serialize references (pointers to objects).  And this makes sense &#8211; there&#8217;s no guarantee that, upon deserialization, that object is in the same place in memory, or even exists at all.  Therefore, all references in an object will be lost.  (except for circular references within the object&#8230; which I don&#8217;t really use)</p>
<p>But the git objects in include/git depend heavily on object references.  A commit points to its parent commit object.  A tree points to its child tree/blob objects.  Every git object points to the project it belongs to.  So we need some way to preserve these references.</p>
<p>Fortunately, every object in GitPHP is uniquely identifiable in some way.  A blob/tree/commit is identifiable by its hash.  A tag is identifiable by its name.  A project is identifiable by its path.  This means that we can store this &#8220;unique id&#8221; and use it to restore the object reference later.</p>
<p>Therefore, every object needs to be able to convert all its objects into &#8220;references&#8221; &#8211; not PHP&#8217;s object references, but a unique id &#8220;reference&#8221; in order to locate the right object later.  So all serialized objects that contain objects within them will &#8220;reference&#8221; their objects in the __sleep method, by replacing the object with a string ID.  (Since PHP is untyped)</p>
<p>You would think that the &#8220;dereference&#8221; of the string ID back into an object would happen in __wakeup&#8230; however this is not the case.  GitPHP objects use circular references at times.  For example, a commit points to its tree, and a tree points to its parent commit.  This becomes a problem if you try to dereference during __wakeup:</p>
<ol>
<li>Deserialize the commit object.  __wakeup attempts to load its tree object&#8230;</li>
<li>Load and deserialize the tree object.  __wakeup attempts to load its parent commit&#8230;</li>
<li>Deserialize the commit object.  __wakeup attempts to load its tree object&#8230;</li>
<li>Load and deserialize the tree object&#8230;</li>
</ol>
<p>You get the idea &#8211; you&#8217;ve got an infinite deserialization loop.</p>
<p>Therefore, what happens is a just-in-time dereference.  Since I wrapped every property with a getter/setter (because PHP&#8217;s method of adding behavior to properties really sucks), I can add behavior to be executed just before fetching a property.  In this case, objects remain as string IDs after deserializing the object, up until you need them&#8230; at which point they get on-demand dereferenced back into objects right before returning that object to you.  I&#8217;ve used this scheme before, since a lot of property getters load the data from the git repository right on-demand right before returning the value to you.</p>
<p>It&#8217;s a bit complex, but hopefully that explanation helped.  You can always check out the code as well.  Let me know if you have any questions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiphux.com/2010/10/25/the-cache-strikes-back-the-gitphp-object-cache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GitPHP project array format</title>
		<link>http://www.xiphux.com/2010/10/16/gitphp-project-array-format/?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://www.xiphux.com/2010/10/16/gitphp-project-array-format/#comments</comments>
		<pubDate>Sat, 16 Oct 2010 21:02:43 +0000</pubDate>
		<dc:creator>xiphux</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[gitphp]]></category>

		<guid isPermaLink="false">http://www.xiphux.com/?p=781</guid>
		<description><![CDATA[I&#8217;m considering changing the format again of the project array specified in project.conf.php in a backwards incompatible way. It&#8217;s in order to provide an enhancement to be able to override any setting on a project by project basis regardless of whether you&#8217;re using the project array format, the plain directory list, or the project file ]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m considering changing the format again of the project array specified in project.conf.php in a backwards incompatible way.  It&#8217;s in order to provide an enhancement to be able to override any setting on a project by project basis regardless of whether you&#8217;re using the project array format, the plain directory list, or the project file list.  (Currently you can only do this with the array format)</p>
<p>I realize I just introduced this format in 0.2.0, a month ago, and I know it&#8217;s a pain to change this again &#8211; if anyone has any strong objections to this, let me know and I could probably find a messier but backwards compatible way.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiphux.com/2010/10/16/gitphp-project-array-format/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GitPHP 0.2.1</title>
		<link>http://www.xiphux.com/2010/10/09/gitphp-0-2-1/?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://www.xiphux.com/2010/10/09/gitphp-0-2-1/#comments</comments>
		<pubDate>Sat, 09 Oct 2010 20:59:46 +0000</pubDate>
		<dc:creator>xiphux</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[gitphp]]></category>

		<guid isPermaLink="false">http://www.xiphux.com/?p=770</guid>
		<description><![CDATA[I&#8217;ve released GitPHP 0.2.1. This release fixes a number of the bugs that arose from the rewrite first released in 0.2.0, and also adds a number of features that I intended to add but didn&#8217;t make it into 0.2.0. The biggest change is that my homebrew translation framework that appeared in 0.2.0 was ripped out ]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve released GitPHP 0.2.1.  This release fixes a number of the bugs that arose from the rewrite first released in 0.2.0, and also adds a number of features that I intended to add but didn&#8217;t make it into 0.2.0.</p>
<p>The biggest change is that my homebrew translation framework that appeared in 0.2.0 was ripped out and replaced with gettext.  I apologize if you already started translating, but gettext is much easier to work with, I promise.  I&#8217;ve provided a short starter HOWTO in doc/TRANSLATING.  As always, you can send a translation to me for inclusion in the official release.<br />
If you&#8217;re running gitphp from the git repo instead of the tarball, you will need to run util/msgfmt.sh from the gitphp base directory after cloning the repository to compile the gettext MO files, or else the translations won&#8217;t work.  The tarball releases have this done already and will work out of the box.</p>
<p>Language can also be selected on the fly by users now, using a drop-down menu.  The default setting for this for a first-time visitor is the browser&#8217;s preferred language if supported, followed by whatever&#8217;s specified in the gitphp config, followed by English as the final default.  Check it out at the <a href="http://gitphp.xiphux.com/">live copy</a>.</p>
<p>Also, this is the first release of gitphp that provides another language besides English: gitphp is now available in French, thanks to Zaran.</p>
<p>The other notable enhancement is the ability for users to select arbitrary commits on the log or commit pages, and diff them.  Each commit in the log or shortlog shows a &#8220;select for diff&#8221; link.  Click this by a commit to select it.  The selected diff will appear in the very top header of the log or shortlog, with a partial commit message (with the full commit tooltip), and the option to deselect it.  The &#8220;select for diff&#8221; links by commits will now change to &#8220;diff with selected&#8221; &#8211; click this to do the diff.  (The link by the currently selected commit will change to &#8220;deselect&#8221;)  This selection persists across pages of the shortlog/log, so you can diff across two different pages.  The selection will also persist when switching back and forth from log to shortlog and vice versa, although going to a non-log page will discard the selection.  The implementation is original, but I&#8217;d like to thank Calen Pennington for some of the UI designs.</p>
<p>Here&#8217;s the full list of changes:</p>
<ul>
<li>GitPHP now uses gettext for internationalization.  I&#8217;ve also provided a short howto in doc/TRANSLATING</li>
<li>Language can now be changed on the fly by the user using a drop-down menu in the upper right.  The initial default for this is the user&#8217;s preferred language from their browser.  If there is no translation for the user&#8217;s language, it will fall back to the locale in the config, then to English as the final default.  But of course, the user can always change the language whenever they want.  The user&#8217;s language choice is remembered by a browser cookie.</li>
<li>French translation, thanks to Zaran</li>
<li>On the log and shortlog pages, arbitrary diffs can be selected and diffed.  You can select one commit, then diff with any other.  Your selected diff will persist across pages, in case you want to diff between two different pages.  The selected diff, if there is one, will appear in the top header, above the log/shortlog.  This selection will also persist when switching from the shortlog to the log and vice versa.</li>
<li>New pieces of metadata can now be specified for a project using the advanced project array format (in projects.conf.php): description, owner, clone url, and push url.  Specifying any of these for a project will override that data for that project only.</li>
<li>Tree view and commit view now provide a &#8220;plain&#8221; link by blobs to go right to the plaintext view of that blob</li>
<li>Added a file history link to the blob page</li>
<li>To make things a little easier to track, the home text template that configures the header of the project list (templates/hometext.tpl) is no longer provided in the tarball.  The system will show the default hometext, but you can <strong>create</strong> templates/hometext.tpl with your content to customize the header.  Therefore, this is backwards compatible for everyone who already has a customized hometext.tpl template.</li>
<li>The &#8220;projects&#8221; link in the upper left that takes you to the main project list can be customized.  Please be advised that if you override this, you&#8217;re also hardcoding the language that it appears in.</li>
<li>Fixed a bug where search wouldn&#8217;t work on git &lt; 1.5.3</li>
<li>Fixed a bug where some dates wouldn&#8217;t show up correctly on windows</li>
<li>Fixed a bug where an exception would be thrown if no config file existed</li>
<li>Fixed bugs where GitPHP would crash when an empty project with no commits was being loaded</li>
<li>Fixed a bug in reading projects from a list file, where owners with multiple words in the name would only display the first word</li>
<li>Fixed a bug on the commit page, where the history link by a deleted file wouldn&#8217;t work</li>
<li>Fixed a bug where the javascript commit tooltip would appear out of the browser window for a commit close to the bottom of the page</li>
<li>XHTML validation fixes, thanks to Christian Weiske</li>
<li>Minor visual fix where source files in commit diffs were missing the &#8220;a/&#8221; prefix (but destinations files still had the &#8220;b/&#8221; prefix)</li>
</ul>
<p>Get it on the <a href="http://www.xiphux.com/programming/gitphp/">GitPHP</a> page.</p>
<p>As always, anything &#8211; bugs, enhancement requests, etc &#8211; can be reported on the <a href="http://mantis.xiphux.com">Mantis bugtracker</a>.  I&#8217;d like to give a big thanks to the people that have been using the bugtracker already; it&#8217;s been a huge help in keeping me and my development organized.</p>
<p>I&#8217;ve also created a <a href="http://www.ohloh.net/p/gitphp">page for GitPHP on Ohloh</a>, if you&#8217;re interested.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiphux.com/2010/10/09/gitphp-0-2-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

