Archive for the ‘Programming’ Category

GitPHP 0.2.1

I’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’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 and replaced with gettext. I apologize if you already started translating, but gettext is much easier to work with, I promise. I’ve provided a short starter HOWTO in doc/TRANSLATING. As always, you can send a translation to me for inclusion in the official release.
If you’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’t work. The tarball releases have this done already and will work out of the box.

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’s preferred language if supported, followed by whatever’s specified in the gitphp config, followed by English as the final default. Check it out at the live copy.

Also, this is the first release of gitphp that provides another language besides English: gitphp is now available in French, thanks to Zaran.

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 “select for diff” 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 “select for diff” links by commits will now change to “diff with selected” – click this to do the diff. (The link by the currently selected commit will change to “deselect”) 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’d like to thank Calen Pennington for some of the UI designs.

Here’s the full list of changes:

  • GitPHP now uses gettext for internationalization. I’ve also provided a short howto in doc/TRANSLATING
  • 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’s preferred language from their browser. If there is no translation for the user’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’s language choice is remembered by a browser cookie.
  • French translation, thanks to Zaran
  • 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.
  • 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.
  • Tree view and commit view now provide a “plain” link by blobs to go right to the plaintext view of that blob
  • Added a file history link to the blob page
  • 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 create 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.
  • The “projects” 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’re also hardcoding the language that it appears in.
  • Fixed a bug where search wouldn’t work on git < 1.5.3
  • Fixed a bug where some dates wouldn’t show up correctly on windows
  • Fixed a bug where an exception would be thrown if no config file existed
  • Fixed bugs where GitPHP would crash when an empty project with no commits was being loaded
  • Fixed a bug in reading projects from a list file, where owners with multiple words in the name would only display the first word
  • Fixed a bug on the commit page, where the history link by a deleted file wouldn’t work
  • 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
  • XHTML validation fixes, thanks to Christian Weiske
  • Minor visual fix where source files in commit diffs were missing the “a/” prefix (but destinations files still had the “b/” prefix)

Get it on the GitPHP page.

As always, anything – bugs, enhancement requests, etc – can be reported on the Mantis bugtracker. I’d like to give a big thanks to the people that have been using the bugtracker already; it’s been a huge help in keeping me and my development organized.

I’ve also created a page for GitPHP on Ohloh, if you’re interested.

GitPHP bugs

As I expected, the newest GitPHP (0.2.0) is a little buggy compared to previous versions. The disadvantage of moving to an object oriented system is that you have to check for null objects constantly, because calling a method on a non-object will crash php. So right now there are a couple outstanding crashes in GitPHP in places where I missed a check, where things will crash if there is a likelihood for an object to be null – no configuration file, a project with no commits, etc – check the bugtracker for details. If this is a showstopper for you, you would probably be better off using a previous version (on the previous gitphp versions page). I’m on vacation and away from my development machine until the middle of next week, but getting these fixed in the current HEAD are my first priority when I get back. I apologize for the inconvenience.

On a side note, I’m glad people are actually using the bugtracker now. The bugs streaming in by email were kind of hard to keep track of :)

GitPHP 0.2.0

Well, it’s my birthday, which I figure is a good enough reason to finally release the GitPHP rewrite.

I’m releasing it as 0.2.0 – I figured that the architectural rewrite is significant enough to warrant some kind of larger version bump, but since it doesn’t look and behave all that differently to end users, a major version bump isn’t necessary.

Here’s what I came up with for the changelog, although as a total rewrite from scratch, there could very well be other “features” and changes that made it in that I’m not thinking of, just by virtue of the entire codebase changing:

  • Major architectural rewrite – end users aren’t heavily affected, but developers will appreciate it. On the other hand, PHP 4 is no longer supported
  • Much more simplified config that works on an override strategy – so your config file can be much cleaner
  • Can fetch snapshots of a subtree (subdirectory), rather than the entire tree – thanks to Tejas Dinkar
  • When listing out projects in the projectroot (instead of explicitly listing them in the config), can optionally respect the git-daemon-export-ok magic file used by git-daemon to include/exclude projects – thanks to Calen Pennington
  • When listing out projects in the projectroot (instead of explicitly listing them in the config), projects in subdirectories will be automatically “categorized” by their directories – thanks to Calen Pennington
  • AJAX javascript tooltips to display the full commit message when hoving over a commit link, and the full tag message for a tag object
  • Use AJAX javascript to load blame info right into the blob page, instead of posting to a separate page
  • Internationalization support, although we don’t have any translations yet
  • Blame page now supports syntax highlighting
  • New way of specifying categories for projects – in preparation for more metadata to be added to projects
  • The little colored ref badges now have different colors to distinguish between heads and tags
  • File sizes by blobs in the tree view
  • File searching shows the matching line number

In theory this will work as a drop-in replacement for previous versions – no changes necessary. However, because of the newer and cleaner config system, it might be worth it to run through your configuration again using the example and copying from the defaults file, just to clean up the amount of stuff you have to look at in your config file. Also, if you were using the method of defining projects as an array to specify categories, you might want to have a look at the new way of specifying the categories in projects.conf.php if you have a chance. You don’t gain anything from changing to the new format now so you don’t have to, but eventually new features will be added to the new format, which you won’t be able to benefit from if you aren’t using it.

As I mentioned in the previous post, internationalization is now open again, so if you’re interested in doing a translation, contact me.

As always, downloads are available on the GitPHP page, and bugs / enhancement requests can be reported on the Mantis bugtracker – with ~12000 new lines of code, I’m certaintly expecting a few unforseen bugs. Source code is always browsable on the live GitPHP.

You can always let me know what you think of the rewrite (or the project in general) by multiple means: email, commenting on my site, twitter, etc.

I hope you enjoy the new code.

Return top