/** * Get shortlog entries for the given project. */ function handle_shortlog($project, $hash = 'HEAD', $page = 0) { global $conf; $refs_by_hash = git_ref_list($project, true, true, $conf['shortlog_remote_labels']); $result = array(); $revs = git_get_rev_list($project, $page * $conf['summary_shortlog'], $conf['summary_shortlog'], $hash); foreach ($revs as $rev) { $info = git_get_commit_info($project, $rev); $refs = array(); if (in_array($rev, array_keys($refs_by_hash))) { $refs = $refs_by_hash[$rev]; } $result[] = array('author' => $info['author_name'], 'date' => strftime($conf['datetime'], $info['author_utcstamp']), 'message' => $info['message'], 'commit_id' => $rev, 'tree' => $info['tree'], 'refs' => $refs); } return $result; }
header("Content-Transfer-Encoding: binary"); // TODO git-style filename header("Content-Disposition: attachment; filename=\"{$filename}\";"); run_git_passthru($project, "format-patch --stdout {$hash}^..{$hash}"); die; } elseif ($action === 'rss-log') { $page['project'] = validate_project($_REQUEST['p']); $ext_url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']) . '/'; $page['rss_title'] = "Log for {$page['project']}"; $page['rss_link'] = $ext_url . makelink(array('a' => 'summary', 'p' => $page['project'])); $page['rss_description'] = "Git log for project {$page['project']}, generated by ViewGit."; $page['rss_pubDate'] = rss_pubdate(time()); $page['rss_ttl'] = $conf['rss_ttl']; $page['rss_items'] = array(); $diffstat = strstr($conf['rss_item_description'], '{DIFFSTAT}'); $revs = git_get_rev_list($page['project'], 0, $conf['rss_max_items']); foreach ($revs as $rev) { $info = git_get_commit_info($page['project'], $rev); $link = $ext_url . makelink(array('a' => 'commit', 'p' => $page['project'], 'h' => $rev)); if ($diffstat) { $info['diffstat'] = git_diffstat($page['project'], $rev); } $page['rss_items'][] = array('title' => rss_item_format($conf['rss_item_title'], $info), 'guid' => $link, 'link' => $link, 'description' => rss_item_format($conf['rss_item_description'], $info), 'pubdate' => rss_pubdate($info['author_utcstamp'])); } require 'templates/rss.php'; die; } elseif ($action === 'search') { $template = 'shortlog'; $page['project'] = validate_project($_REQUEST['p']); $info = git_get_commit_info($page['project']); $page['commit_id'] = $info['h'];