From 5c16fe724369a520077ea311fb1228a4a472af6f Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 28 Mar 2017 11:03:13 +0200 Subject: swap order --- git2rss | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/git2rss b/git2rss index 76b7a13..98e7c2d 100755 --- a/git2rss +++ b/git2rss @@ -23,15 +23,6 @@ use Suin\RSSWriter\Channel; use Suin\RSSWriter\Feed; use Suin\RSSWriter\Item; -// Load previous changes -if (file_exists(__DIR__ . '/git2rss.json')) { - $json = file_get_contents(__DIR__ . '/git2rss.json'); - $histo = json_decode($json, true); - printf("RSS %d entries loaded\n", count($histo)); -} else { - $histo = array(); -} - // Current change exec('git log --format=fuller -1', $out); $log = exec("git log --pretty=format:%H,%at,%cn,%an,%s -1"); @@ -56,6 +47,15 @@ $short = substr($entry['hash'], 0, 7); printf("Welcome %s\n", $entry['commiter']); echo "RSS new entry: ${entry['author']} pushed to ${entry['repo']} (${entry['head']},$short): ${entry['comment']}\n"; +// Load previous changes +if (file_exists(__DIR__ . '/git2rss.json')) { + $json = file_get_contents(__DIR__ . '/git2rss.json'); + $histo = json_decode($json, true); + printf("RSS %d entries loaded\n", count($histo)); +} else { + $histo = array(); +} + // 50 recent changes, and save $histo = array_merge([$entry], $histo); while (count($histo) > FEEDSIZE) { -- cgit