diff options
author | SZEDER Gábor <szeder@ira.uka.de> | 2011-03-31 23:41:18 +0200 |
---|---|---|
committer | SZEDER Gábor <szeder@ira.uka.de> | 2013-06-24 17:22:10 +0200 |
commit | 3a43c4b5bd19528229ef36b28d648d5ac98f15f1 (patch) | |
tree | e7674864945a9d030ab0528018538303e4b02a3a /t/t5521-pull-options.sh | |
parent | bash prompt: use bash builtins to find out rebase state (diff) | |
download | tgif-3a43c4b5bd19528229ef36b28d648d5ac98f15f1.tar.xz |
bash prompt: use bash builtins to find out current branch
__git_ps1() runs the '$(git symbolic-ref HEAD)' command substitution
to find out whether we are on a branch and to find out the name of
that branch. This imposes the overhead of fork()ing a subshell and
fork()+exec()ing a git process.
Since HEAD is in most cases a single-line file and the symbolic ref
format is quite simple to recognize and parse, read and parse it using
only bash builtins, thereby sparing all that fork()+exec() overhead.
Don't display the git prompt if reading HEAD fails, because a readable
HEAD is required for a git repository. HEAD can also be a symlink
symbolic ref (due to 'core.preferSymlinkRefs'), so use bash builtins
for reading HEAD only when HEAD is not a symlink.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Diffstat (limited to 't/t5521-pull-options.sh')
0 files changed, 0 insertions, 0 deletions