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. Changes in v3: Incorporated suggestions from v2 to improve code and commit message. To be more precise about the code part, In 2/4 slightly re-ordered the parameters to move the flag parameters to the end. In 3/4, changed the return type of the branchname validation functions to be the enum (whose values they return) as suggested by Stefan. Dropped the PATCH 3/5 of v2 as there was another series[1] that did the refactor and got merged to 'next'. I have now re-rolled the series over 'next' [pointing at 273055501 (Sync with master, 2017-10-24)]. This has made the code in 3/4 a little clumsy (at least to me) as I tried to achieve to achieve what the previous patches did with the new validate*_branchname functionS. Let me know, if it looks too bad. So this could go on top of 'next' without any conflicts but in case I missed something, let me know. The series could be found in my fork[2]. Any feedback welcome. Thanks, Kaartic [1] : https://public-inbox.org/git/20171013051132.3973-1-gitster@xxxxxxxxx [2] : https://github.com/sivaraam/git/tree/work/branch-revamp Kaartic Sivaraam (4): branch: improve documentation and naming of 'create_branch()' branch: re-order function arguments to group related arguments branch: introduce dont_fail parameter for branchname validation builtin/branch: give more useful error messages when renaming branch.c | 63 ++++++++++++++++++++++++++++++------------------------ branch.h | 57 ++++++++++++++++++++++++++++++++++++++---------- builtin/branch.c | 49 ++++++++++++++++++++++++++++++++++-------- builtin/checkout.c | 11 +++++----- 4 files changed, 127 insertions(+), 53 deletions(-) -- 2.15.0.rc2.401.g3db9995f9