summaryrefslogtreecommitdiffstats
path: root/status.sh
blob: 893dde2c39dc822d35cc4ac110b5676c8062fad3 (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
40
41
42
43
44
##
# systrunk status
#
# View current information such as which branch your worktree is
# TRACking, which commit it is BASEd on, and how far out-of-date
# it is.  Additionally, report whether a merge or update operation
# is currently in-progress.
##
function systr_status
{
    read remote <.systr/remote
    read path   <.systr/path
    read BASE   <.systr/BASE
    read TRAC   <.systr/TRAC

    if [ -f ".systr/MERG" ]; then
        read MERG <.systr/MERG
        mergcommit=$(get_commit "$MERG")

        if [[ "$MERG" == "TRAC" ]]; then
            echo "Update in progress, to $mergcommit"
        else
            echo "Merge in progress, from $MERG ($mergcommit)"
        fi

        echo ""
    fi

    traccommit=$(get_commit "$TRAC")

    if [[ "$TRAC" == "$traccommit" ]]; then
        echo "Not tracking any branch"
    else
        echo "Tracking $TRAC ($traccommit)"
    fi

    if [[ "$BASE" == "NULL" ]]; then
        echo "BASE unset"
    else
        echo "BASE at $BASE"
    fi

    echo "# TODO # Possibly, Up-to-date"
}