summaryrefslogtreecommitdiffstats
path: root/init.sh
blob: b77201525c183806dab5dd14971938c21877ba85 (plain) (blame)
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
##
# init_wktree <unused> <unused> [<remote>] <path>
#
# Assert that the repository at <path> exists, then setup the
# .systr directory at the CWD.
##
function init_wktree
{
    if [ $# -gt 3 ]; then
        remote=$3
        shift
    else
        remote=""
    fi

    path=$3

    # local repository #
    if [[ "$remote" == "" ]]; then
        if [ ! -f "$path/HEAD" ]; then
            echo "Error: $path is not a repository"
            exit 1
        fi

        mkdir -p .systr/

        echo "" >.systr/remote
        echo "$path" >.systr/path
        echo "NULL"  >.systr/BASE
        echo "NULL"  >.systr/TRAC

        echo "Setup worktree at $(pwd)"

    # remote repository #
    else
        exit 1

    fi
}