diff options
author | SZEDER Gábor <szeder@ira.uka.de> | 2013-06-17 22:58:42 +0200 |
---|---|---|
committer | SZEDER Gábor <szeder@ira.uka.de> | 2013-06-24 17:22:10 +0200 |
commit | efaa0c153297f551a42fd1e21f28f51f4924f316 (patch) | |
tree | dba85c59520f912842b9b5c9f9fda8cbc41812a6 /t/t5521-pull-options.sh | |
parent | bash prompt: use bash builtins to find out current branch (diff) | |
download | tgif-efaa0c153297f551a42fd1e21f28f51f4924f316.tar.xz |
bash prompt: combine 'git rev-parse' executions in the main code path
There are a couple of '$(git rev-parse --<opt>)' command substitutions
in __git_ps1() and three of them are executed in the main code path:
- the first to get the path to the .git directory ('--git-dir'),
- the second to check whether we're inside the .git directory
('--is-inside-git-dir'),
- and the last, depending on the results of the second, either
* to check whether it's a bare repo ('--is-bare-repository'), or
* to check whether inside a work tree ('--is-inside-work-tree').
Naturally, this imposes the overhead of fork()ing three subshells and
fork()+exec()ing three git commands.
Combine these four 'git rev-parse' queries into a single one and use
bash parameter expansions to parse the combined output, i.e. to
separate the path to the .git directory from the true/false of
'--is-inside-git-dir', etc. This way we can eliminate two of the
three subshells and git commands.
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