list_commands: only call git_exec_path if it is needed
Even if it always needed Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
1f08e5ce24
commit
61c5d431de
2
help.c
2
help.c
@ -212,7 +212,6 @@ void load_command_list(const char *prefix,
|
|||||||
void list_commands(const char *title, struct cmdnames *main_cmds,
|
void list_commands(const char *title, struct cmdnames *main_cmds,
|
||||||
struct cmdnames *other_cmds)
|
struct cmdnames *other_cmds)
|
||||||
{
|
{
|
||||||
const char *exec_path = git_exec_path();
|
|
||||||
int i, longest = 0;
|
int i, longest = 0;
|
||||||
|
|
||||||
for (i = 0; i < main_cmds->cnt; i++)
|
for (i = 0; i < main_cmds->cnt; i++)
|
||||||
@ -223,6 +222,7 @@ void list_commands(const char *title, struct cmdnames *main_cmds,
|
|||||||
longest = other_cmds->names[i]->len;
|
longest = other_cmds->names[i]->len;
|
||||||
|
|
||||||
if (main_cmds->cnt) {
|
if (main_cmds->cnt) {
|
||||||
|
const char *exec_path = git_exec_path();
|
||||||
printf("available %s in '%s'\n", title, exec_path);
|
printf("available %s in '%s'\n", title, exec_path);
|
||||||
printf("----------------");
|
printf("----------------");
|
||||||
mput_char('-', strlen(title) + strlen(exec_path));
|
mput_char('-', strlen(title) + strlen(exec_path));
|
||||||
|
Loading…
Reference in New Issue
Block a user