@@ -21,30 +21,45 @@ export LP_BATTERY_THRESHOLD=${LP_BATTERY_THRESHOLD:-75}
21
21
export LP_LOAD_THRESHOLD=${LP_LOAD_THRESHOLD:- 60}
22
22
export LP_TEMP_THRESHOLD=${LP_TEMP_THRESHOLD:- 80}
23
23
24
-
24
+ unset _lp_legacy _lp_escape __lp_escape
25
25
source " $targetdir /liquidprompt"
26
26
prompt () { true ; }
27
27
export PS2=" ┃ "
28
28
export LP_PS1_PREFIX=" ┌─"
29
29
export LP_PS1_POSTFIX=" \n└▪ "
30
30
export LP_ENABLE_RUNTIME=0
31
31
32
+ _lp_legacy ()
33
+ {
34
+ type -t _lp_escape & > /dev/null
35
+ }
36
+
37
+ _lp_legacy && __lp_escape ()
38
+ {
39
+ ret=" $( _lp_escape " $@ " ) "
40
+ }
41
+
32
42
_lp_git_branch ()
33
43
{
34
44
(( LP_ENABLE_GIT )) || return
35
45
36
46
\g it rev-parse --is-inside-work-tree > /dev/null 2>&1 || return
37
47
38
- local branch
48
+ local commit branch ret
49
+
50
+ commit=" $( \g it rev-parse --short -q HEAD 2> /dev/null) "
51
+
39
52
# Recent versions of Git support the --short option for symbolic-ref, but
40
53
# not 1.7.9 (Ubuntu 12.04)
41
54
if branch=" $( \g it symbolic-ref -q HEAD) " ; then
42
- _lp_escape " $( \g it rev-parse --short=5 -q HEAD 2> /dev/null) :${branch# refs/ heads/ } "
55
+ __lp_escape " $commit :${branch# refs/ heads/ } "
56
+ lp_vcs_branch=" $ret "
43
57
else
44
58
# In detached head state, use commit instead
45
59
# No escape needed
46
- \g it rev-parse --short -q HEAD 2> /dev/null
60
+ lp_vcs_branch= " $commit "
47
61
fi
62
+ _lp_legacy && echo $lp_vcs_branch || return 0
48
63
}
49
64
50
65
_lp_time () {
0 commit comments