aboutsummaryrefslogtreecommitdiff
path: root/zsh-completion/_gitbmerge
blob: 0b598a075cbb4b133eb3ad65152e09ef5d0ddaa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#compdef gitbmerge
#autoload

_gitbmerge() {
	((CURRENT > 2)) &&  return # Complete only single branch
	local gdir branch
	gdir="$(git rev-parse --git-common-dir 2>/dev/null)" || return
	local branches=()
	# TODO ignore current HEAD (merging HEAD to HEAD does not makes sense)
	while read -r branch; do
		branches+=("$branch")
	done < <(find "$gdir/refs/heads" -mindepth 1 -printf '%P\n')
	_describe -t branches 'gitbmerge' branches
}

_gitbmerge
# vim: ft=zsh