Button Button

Sputnik can store its data in Git. In this case, Sputnik's history is Git's history.

The instructions assume a standard installation of Sputnik "Earth" (see Installation), though this plugin can also be used with Saci/Versium outside Sputnik.

Installation and Configuration

First, install versium-git rock:

./bin/luarocks install --only-from=http://sputnik.freewisdom.org/rocks/earth/ versium-git

Then set two config variables

VERSIUM_STORAGE_MODULE = "versium.git", 
VERSIUM_PARAMS = {'/home/yuri/sputnik/wiki-data-git/'},

The wiki-data directory needs to exist, be writable by your server, and needs to be initialized as a git repository. E.g.:

cd ~/sputnik/wiki-data-git/
git init
chmod -R a+rw .git

If using CGI, depending on your server setup, you may also need to add this to your launcher script:

require"lfs"
lfs.chdir("/home/yuri/sputnik/wiki-data-git/")

What Does This Do?

Sputnik will store it's history using git. This means that you can then view your history using git:

$ git log
commit 3b03785a641c61fea6084b90574eb35c72f2c687
Author: anonymous <anonymous@sputnik>
Date:   Fri Jul 25 15:58:37 2008 -0700

    testing

    ---extra-fields-------------------------
    minor=""
    ip="127.0.0.1"

(You can also use "git log (some_node).lua" to view history of an individual page.)

We can similarly view diffs of individual changes:

git show 3b03785
commit 3b03785a641c61fea6084b90574eb35c72f2c687
Author: anonymous <anonymous@sputnik>
Date:   Fri Jul 25 16:02:06 2008 -0700

    (no comment)

    ---extra-fields-------------------------
    minor=""
    ip="127.0.0.1"

diff --git a/index.lua b/index.lua
index 41d3773..38fe811 100644
--- a/index.lua
+++ b/index.lua
@@ -4,7 +4,7 @@ category       = ""
 content        = [=[Congratulations, you just installed
 [Sputnik](http://www.freewisdom.org/projects/sputnik/)!  

-What's next? 
+What's now? 

Additionally, you can now change any of the nodes "by hand" in your favorite editor, then commit the change with git and it will show up in Sputnik's history. Just set your git user name and "email" to values that Sputnik will recognize as a sputnik user so that you don't break the "history" node:

git config --global user.name "admin"
git config --global user.email admin@sputnik