magit/magit — pull request #1021 by tarsius (2013-10-30 23:10:00+00:00)
Title: Cleanup ref reading (part 1)

This PR is part of my effort to cleanup the handling of refs. This one focuses on ref reading by removing a lot duplicated code. It does so by removing unneeded things one step at a time. I have not yet touched the most messy parts, here I just focus an the easier things.

Generally what these commits do is change how the default ref for completion is determined. In many cases I think, that removing the less powerful code (written specifically for one or a handful of uses), and replacing it with `magit-guess-branch` and possibly an additional fallback (such as `"HEAD"`), is an improvement. However it is possible that there are a few commands that now offer some default that makes little sense.

How the completion defaults are determined has to looked at individually for each use, but doing so is much easier if these uses don't look and function very differently from each other. I am fairly sure that in most cases these differences, that I have removed here, are not due to conscious decisions, but are the result of the author not being aware of existing code, or being unable or unwilling to adapt (generalize) the existing code. That has been going on for a while now - at some point someone had to do something about it :-)