summaryrefslogtreecommitdiff
path: root/bin/git-ps1
blob: 8a09800911638f07b07a58fb0f31ade1b265582c (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
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env bash
r=
b=
g="$(git rev-parse --git-dir 2>/dev/null)"

if [ -n "$g" ]; then
    if [ -d "$g/../.dotest" ]
        then
        if test -f "$g/../.dotest/rebasing"
            then
            r="|REBASE"
        elif test -f "$g/../.dotest/applying"
            then
            r="|AM"
        else
            r="|AM/REBASE"
        fi
        b="$(git symbolic-ref HEAD 2>/dev/null)"
    elif [ -f "$g/.dotest-merge/interactive" ]
        then
        r="|REBASE-i"
        b="$(cat "$g/.dotest-merge/head-name")"
    elif [ -d "$g/.dotest-merge" ]
        then
        r="|REBASE-m"
        b="$(cat "$g/.dotest-merge/head-name")"
    elif [ -f "$g/MERGE_HEAD" ]
        then
        r="|MERGING"
        b="$(git symbolic-ref HEAD 2>/dev/null)"
    else
        if [ -f "$g/BISECT_LOG" ]
            then
            r="|BISECTING"
        fi
        if ! b="$(git symbolic-ref HEAD 2>/dev/null)"
            then
            if ! b="$(git describe --exact-match HEAD 2>/dev/null)"
                then
                b="$(cut -c1-7 "$g/HEAD")..."
            fi
        fi
    fi

    if [ -n "$1" ]; then
        printf "$1" "${b##refs/heads/}$r"
    else
        printf "%s" "${b##refs/heads/}$r"
    fi
else
    printf "not-in-git"
fi
>Andrea Gelmini 2015-12-21loplugin:unusedmethodsNoel Grandin 2015-11-25loplugin:unusedfields in include/package,include/registryNoel Grandin 2015-11-10loplugin:nullptr (automatic rewrite)Stephan Bergmann 2015-11-06coverity#1338272 Uncaught exceptionCaolán McNamara 2015-11-06coverity#1338270 Uncaught exceptionCaolán McNamara 2015-11-06coverity#1338252 Uncaught exceptionCaolán McNamara 2015-10-26remove extra spaces around ::Noel Grandin 2015-10-12Replace "SAL_OVERRIDE" with "override" in LIBO_INTERNAL_ONLY codeStephan Bergmann 2015-10-12Replace "SAL_DELETED_FUNCTION" with "= delete" in LIBO_INTERNAL_ONLY codeStephan Bergmann 2015-10-07Abstract out repeated code into a lambdaStephan Bergmann 2015-10-01loplugin:unusedmethodsNoel Grandin 2015-09-30Fix typosAndrea Gelmini 2015-09-29loplugin:removeunusedmethods, remove unused stuffNoel Grandin 2015-08-23tdf#39440 cppcheck: redundantAssignmentMichael Weghorn 2015-08-21Force #defined constants to sal_uInt32 to reduce conversion warningsMatteo Casalin 2015-08-20new loplugin automemNoel Grandin 2015-07-23inline a handful of use-once #definesNoel Grandin 2015-07-16loplugin:simplifyboolStephan Bergmann 2015-07-08Fix typosAndrea Gelmini 2015-07-03Make RegistryTypeWriter non-copyableStephan Bergmann 2015-07-03Remove RegistryTypeWriter_Api indirectionStephan Bergmann 2015-07-03Remove unused functionsStephan Bergmann 2015-07-03Make RegistryTypeReader non-copyableStephan Bergmann 2015-07-03Remove RegistryTypeReader_Api indirectionStephan Bergmann 2015-07-03Remove unused functionsStephan Bergmann 2015-07-03No need for a C API hereStephan Bergmann 2015-07-03Move module-private includes from include/registry/ to registry/Stephan Bergmann 2015-07-02loplugin:unusedmethods registry,storeNoel Grandin 2015-06-15remove unnecessary check for null when calling deleteNoel Grandin 2015-06-11cppcheck: noExplicitConstructorCaolán McNamara