diff options
| author | Daniel Shahaf <d.s@daniel.shahaf.name> | 2016-08-30 03:36:48 +0000 |
|---|---|---|
| committer | Daniel Shahaf <d.s@daniel.shahaf.name> | 2016-08-31 02:23:39 +0000 |
| commit | c2592b4f7278cb9e3ce3cd663fb5effec570e7d4 (patch) | |
| tree | e03c4053dff2e0be662d30747394cf57c2bbe056 /Completion/Unix/Command/_git | |
| parent | 39108 (tweaked): _postfix: Support $enable_long_queue_ids. (diff) | |
| download | zsh-c2592b4f7278cb9e3ce3cd663fb5effec570e7d4.tar zsh-c2592b4f7278cb9e3ce3cd663fb5effec570e7d4.tar.gz zsh-c2592b4f7278cb9e3ce3cd663fb5effec570e7d4.tar.bz2 zsh-c2592b4f7278cb9e3ce3cd663fb5effec570e7d4.tar.lz zsh-c2592b4f7278cb9e3ce3cd663fb5effec570e7d4.tar.xz zsh-c2592b4f7278cb9e3ce3cd663fb5effec570e7d4.tar.zst zsh-c2592b4f7278cb9e3ce3cd663fb5effec570e7d4.zip | |
39122: __git_recent_branches: Silence warning on an edge case.
(The warning was correct; there is no functional change, though.)
Diffstat (limited to 'Completion/Unix/Command/_git')
| -rw-r--r-- | Completion/Unix/Command/_git | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index afa3bcb4a..8d3bd6307 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -6070,7 +6070,14 @@ __git_recent_branches() { # (We must do this because #3 would otherwise croak on them.) __git_recent_branches__names; branches=( ${(@)reply:*valid_ref_names_munged} ) - # 3. Obtain log messages for all of them in one shot. + # 3. Early out if no matches. + if ! (( $+branches[1] )); then + # This can happen in a fresh repository (immediately after 'clone' or 'init') before + # any 'checkout' commands were run in it. + return 1 + fi + + # 4. Obtain log messages for all of them in one shot. descriptions=( ${(f)"$(_call_program all-descriptions git --no-pager log --no-walk=unsorted --pretty=%s ${(q)branches} --)"} ) if (( $#branches != $#descriptions )); then @@ -6079,7 +6086,7 @@ __git_recent_branches() { return 1 fi - # 4. Synthesize the data structure _describe wants. + # 5. Synthesize the data structure _describe wants. local -a branches_colon_descriptions local branch description for branch description in ${branches:^descriptions} ; do |
