summaryrefslogtreecommitdiff
path: root/t/t2050-git-dir-relative.sh
diff options
context:
space:
mode:
authorLibravatar SZEDER Gábor <szeder@ira.uka.de>2011-03-31 23:41:18 +0200
committerLibravatar SZEDER Gábor <szeder@ira.uka.de>2013-06-24 17:22:10 +0200
commit3a43c4b5bd19528229ef36b28d648d5ac98f15f1 (patch)
treee7674864945a9d030ab0528018538303e4b02a3a /t/t2050-git-dir-relative.sh
parentbash prompt: use bash builtins to find out rebase state (diff)
downloadtgif-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/t2050-git-dir-relative.sh')
0 files changed, 0 insertions, 0 deletions