prompt for local branches?

24 views
Skip to first unread message

Sam Cramer

unread,
Mar 8, 2017, 1:36:37 PM3/8/17
to magit
Is there a way to have magit prompt for local branches only when asking for a branch? Alternately, is there a way to have the completions sorted so that local branches appear first?

Thanks,
Sam

Kyle Meyer

unread,
Mar 12, 2017, 2:52:51 PM3/12/17
to Sam Cramer, magit
Sam Cramer <samc...@gmail.com> writes:

> Is there a way to have magit prompt for local branches only when
> asking for a branch?

No, not if a command calls magit-list-branches rather than
magit-list-local-branches to generate the collection.

> Alternately, is there a way to have the completions sorted so that
> local branches appear first?

Not at the moment. There's an issue about sorting branches by commit
date [*1*] and an issue about positioning branches before tags [*2*]. I
think that both of these issues, as well as your request, could be
addressed by the allowing more control over the order in which
magit-list-refs and friends return refs. I have a patch that does this
in rough form and will put together a PR tonight or tomorrow.

[*1*]: https://github.com/magit/magit/issues/2872
[*2*]: https://github.com/magit/magit/issues/2925

--
Kyle

Kyle Meyer

unread,
Apr 2, 2017, 4:30:56 PM4/2/17
to Sam Cramer, magit
Kyle Meyer <ky...@kyleam.com> writes:

> Sam Cramer <samc...@gmail.com> writes:

[...]

>> Alternately, is there a way to have the completions sorted so that
>> local branches appear first?
>
> Not at the moment. There's an issue about sorting branches by commit
> date [*1*] and an issue about positioning branches before tags [*2*]. I
> think that both of these issues, as well as your request, could be
> addressed by the allowing more control over the order in which
> magit-list-refs and friends return refs.

What I said wasn't quite right. More control over the order in which
magit-list-refs returns branches is needed for the first issue (#2872),
but not the second issue (#2925) or your request. This is because by
default the refs are already in that order: local branches come before
tags and before remote branches. But depending on the completion
framework used and on whether it's a "read multiple" prompt, the
completions may be _displayed_ in a different order. I've merged a PR
that addresses this: https://github.com/magit/magit/pull/3029

--
Kyle
Reply all
Reply to author
Forward
0 new messages