From af89d0945b49391ed3212ddf5def08252da84374 Mon Sep 17 00:00:00 2001 From: Heikki Hokkanen Date: Sat, 12 Dec 2009 15:07:04 +0200 Subject: [PATCH] Allow project 'description' to be given in config. If description is not provided, it's read from .git/description of the respective project, as before. Thanks to Troy Hamilton for the idea. --- inc/example-localconfig.php | 4 ++++ inc/functions.php | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/inc/example-localconfig.php b/inc/example-localconfig.php index 7c97d04..0a74381 100644 --- a/inc/example-localconfig.php +++ b/inc/example-localconfig.php @@ -6,6 +6,10 @@ // This is the only mandatory setting $conf['projects'] = array( 'foo' => array('repo' => '/home/user/projects/foo/.git'), + 'bar' => array( + 'repo' => '/home/user/projects/foo/.git', + 'description' => 'Optional overridden description, otherwise it is taken from .git/description' + ), ); // A bit sorter datetime format: YY-MM-DD HH:MM diff --git a/inc/functions.php b/inc/functions.php index 81033e4..202c5a5 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -63,7 +63,11 @@ function get_project_info($name) $info = $conf['projects'][$name]; $info['name'] = $name; - $info['description'] = file_get_contents($info['repo'] .'/description'); + + // If description is not set, read it from the repository's description + if (!isset($info['description'])) { + $info['description'] = file_get_contents($info['repo'] .'/description'); + } $headinfo = git_get_commit_info($name, 'HEAD'); $info['head_stamp'] = $headinfo['author_utcstamp']; -- 2.11.4.GIT