blob: cee1a770758f9e8549c051069461c927a39b64b5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#!/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
|