ls-tree: Refactor handling of --branch option

Move the filtering logic mostly into helper methods so we have
less code in the main body, making it easier to add more complexity
back later.

Change-Id: Ibc92002c76df4c7235e74bf225e1ffe46dc03225
1 file changed