Building simplicidade.org: notes, projects, and occasional rants

My own entry to the UGFWIINI contest

Some weeks ago, Johannes Schindelin talked about the UGFWIINI (Use Git For What It Is Not Indended) contest. You can read the initial candidates in the git mailing list thread.

A couple of months ago, I had this idea of writting a script that would constantly watch over a directory (including subdirectories) and commit the changes every time anything would change.

At the time, the tought of battling the FSEvents interface was not appealing at all, and it was just a joke anyway. But in the since then several things happened:

So I had no chance but to write such a script.

My version is a quick hack, but already works perfectly. It watches a specific directory, and commits all the changes to a standalone Git repository.

To use just do:

cacm --repo dir_of_git_repo --watch dir_to_watch

and it will start recording your changes with git commits.

Right now, it commits at most once per 5 seconds, but you can tweak that using the command line option --latency latency_in_seconds.

I've uploaded version 0.01 to CPAN. To install just do cpan App::CMAM (it might take 24 hours to spread to your CPAN mirror).

For version 0.02 I'll clean some small details:

  • ignore .git and other common directories;
  • cleanup git invocation: all the output should be hidden from you.

Fun!