[PATCH] Wrap completions in `type git' conditional statement.

STALE3730d

5 messages, 4 authors, 2016-06-15 · open the first message on its own page

[PATCH] Wrap completions in `type git' conditional statement.

From: Sung Pae <hidden>
Date: 2016-06-15 22:47:42

Hello,

I don't know if this has come up before (I didn't notice in a casual grep of git log), but attached is a little patch to wrap the bash completion script in a `type git' check.

From the patch header:
--
The onus for checking if a command exists before loading its completions
properly falls on individual completion files since they are normally
sourced from a completions directory (e.g. source /etc/bash_completion.d/*),
or perhaps from a single file concatenated from other completion files.

Also, this is standard practice with other bash-completion scripts.
--


Cheers,
Sung Pae

Re: [PATCH] Wrap completions in `type git' conditional statement.

From: Nanako Shiraishi <hidden>
Date: 2016-06-15 22:47:56

Junio, could you tell us what happened to this thread?

The patch avoids failing completion script when git is not there.
No discussion.

Re: [PATCH] Wrap completions in `type git' conditional statement.

From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:47:56

Nanako Shiraishi [off-list ref] wrote:
Junio, could you tell us what happened to this thread?

The patch avoids failing completion script when git is not there.
No discussion.
Actually, that's probably my fault.  I never sent an ack or nak,
or anything else really, on this thread.

Originally this was because the completion was trying to run git
as it loaded.  In 1.6.6 this is no longer true, the completion list
is generated lazily on demand during the first completion attempt.

With the lazy loading, I didn't see a reason to add this ugly block
around the entire script.

-- 
Shawn.

Re: [PATCH] Wrap completions in `type git' conditional statement.

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:47:56

"Shawn O. Pearce" [off-list ref] writes:
Nanako Shiraishi [off-list ref] wrote:
quoted
Junio, could you tell us what happened to this thread?

The patch avoids failing completion script when git is not there.
No discussion.
Actually, that's probably my fault.  I never sent an ack or nak,
or anything else really, on this thread.

Originally this was because the completion was trying to run git
as it loaded.  In 1.6.6 this is no longer true, the completion list
is generated lazily on demand during the first completion attempt.

With the lazy loading, I didn't see a reason to add this ugly block
around the entire script.
Thanks, both.

Re: [PATCH] Wrap completions in `type git' conditional statement.

From: Nanako Shiraishi <hidden>
Date: 2016-06-15 22:47:57

Quoting Shawn O. Pearce [off-list ref]:
Nanako Shiraishi [off-list ref] wrote:
quoted
Junio, could you tell us what happened to this thread?

The patch avoids failing completion script when git is not there.
No discussion.
Actually, that's probably my fault.  I never sent an ack or nak,
or anything else really, on this thread.

Originally this was because the completion was trying to run git
as it loaded.  In 1.6.6 this is no longer true, the completion list
is generated lazily on demand during the first completion attempt.

With the lazy loading, I didn't see a reason to add this ugly block
around the entire script.

-- 
Shawn.
Thank you for your explanation.

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help