In builtin/branch, the error messages weren't handled directly by the branch renaming function and was left to the other function. Though this avoids redundancy this gave unclear error messages in some cases. So, make builtin/branch give more useful error messages. The first two patches are preparatory/cleanup patches. The third patch refactors a function to make it more usable/understandable(?). This results only in one functional change as noted there. I've tried my best not to screw anything up as a consequence of that refactor[note 1]. In case I missed something, let me know. The fourth patch introduces part of the logic needed to improve error messages. It's kept separate to keep things reviewable. The fifth patch is the main one which does the improvement of error messages. These patches apply on top of 'master' and be found in my fork[2]. Note: [1]: The Travis CI build did succeed but I don't think we can rely on that a lot because the test aren't exhaustive (I guess). https://travis-ci.org/sivaraam/git/builds/277146416 [2]: https://github.com/sivaraam/git/tree/work/branch-move-revamp Kaartic Sivaraam (5): builtin/checkout: avoid usage of '!!' for expressions branch: document the usage of certain parameters branch: cleanup branch name validation branch: introduce dont_fail parameter for update validation builtin/branch: give more useful error messages when renaming branch.c | 67 +++++++++++++++++++++++++++++++++++++++--------------- branch.h | 44 +++++++++++++++++++++++++---------- builtin/branch.c | 48 +++++++++++++++++++++++++++++++++----- builtin/checkout.c | 7 +++--- t/t3200-branch.sh | 4 ++++ 5 files changed, 130 insertions(+), 40 deletions(-) -- 2.14.1.868.g66c78774b