Skip to content

Instantly share code, notes, and snippets.

View sunny's full-sized avatar
☀️

Sunny Ripert sunny

☀️
View GitHub Profile
function is-git? {
git status &> /dev/null
[ $? != 128 ]
}
function git-init-remote {
name=$(basename $PWD).git
path=~/repositories/$name
if is-git?
then
# Fake `svnlook` for testing prupose.
# ./fake_svnlook.rb changed /home/pouet/blah/svn/kikoo -r 3483
# ^-- will just read /tmp/fakeSvn.3483 :)
abort 'only the `changed` keyword is allowed on fake_svnlook' if ARGV[0] != 'changed'
abort 'only the `-r` option is supported on fake_svnlook' if ARGV[2] != '-r'
abort "svnlook: No such revision #{ARGV[3]}" unless File.exists?(fake_svn = "/tmp/fakeSvn.#{ARGV[3]}")
puts File.read(fake_svn)