#!/bin/dash # We will create a new file in .tigger called "branch.tig" with our current # branch. By default this should be master. All future ops should read this. # Commits will be contained in files starting at 0...n inside our branch dir. # Our directory heirarchy might look like: # .tigger/ # branch.tig // current branch # commit_count.tig // see the below comment @ echo "0"... # master/ # 0/ # commit/ # staged/ # message.tig // because we have a message, it's a finished commit # 1/ # commit/ # staged/ if [ -d ".tigger/" ]; then printf "tigger-init: error: .tigger already exists\n" >&2 exit 1 fi branch="master" # in future should be ~ branch=$(cat ./.tigger/branch.tig) mkdir --parents ".tigger/$branch" echo "$branch" > ".tigger/branch.tig" # This is necessary because their implementation of git branch considers a # global commit count as opposed to a (more logical) per branch commit count. # Whenever we do any commit we have to increment this value (which is only # used for printing so that we are compliant with their autotests). echo "0" > .tigger/commit_count.tig mkdir --parents ".tigger/$branch/0/commit" mkdir --parents ".tigger/$branch/0/staged" printf "Initialized empty tigger repository in .tigger\n" exit 0