Re: [RFC PATCH 3/5] branch: cleanup branch name validation

2017-09-23 Thread Kaartic Sivaraam
On Thursday 21 September 2017 07:07 AM, Junio C Hamano wrote: Kaartic Sivaraam writes: Thanks for giving a better alternative. Sounds catchy. How about `validate_branch_creation`? I do not know what you meant by "catchy", I was intending that 'ok_to_create_branch' was a "nice alternative" w

Re: [RFC PATCH 3/5] branch: cleanup branch name validation

2017-09-20 Thread Junio C Hamano
Kaartic Sivaraam writes: > Thanks for giving a better alternative. Sounds catchy. How about > `validate_branch_creation`? I do not know what you meant by "catchy", but "git grep ok_to_" will tell you that ok-to-$do-something is quite an establish phrasing (if I thought it was a bad way to name i

Re: [RFC PATCH 3/5] branch: cleanup branch name validation

2017-09-20 Thread Kaartic Sivaraam
On Wednesday 20 September 2017 09:50 AM, Junio C Hamano wrote: Also I'd avoid "could", which can be taken as an optimization hint (i.e. "you usually do not have to worry about this thing to already exist, but I am telling you that for this one call that is not the case and you need to be a bit mo

Re: [RFC PATCH 3/5] branch: cleanup branch name validation

2017-09-20 Thread Kaartic Sivaraam
On Wednesday 20 September 2017 09:50 AM, Junio C Hamano wrote: Kaartic Sivaraam writes: -int validate_new_branchname(const char *name, struct strbuf *ref, - int force, int attr_only) +int validate_branch_update(const char *name, struct strbuf *ref, +

Re: [RFC PATCH 3/5] branch: cleanup branch name validation

2017-09-19 Thread Junio C Hamano
Kaartic Sivaraam writes: > -int validate_new_branchname(const char *name, struct strbuf *ref, > - int force, int attr_only) > +int validate_branch_update(const char *name, struct strbuf *ref, > +int could_exist, int clobber_head) "update" to me mea

[RFC PATCH 3/5] branch: cleanup branch name validation

2017-09-19 Thread Kaartic Sivaraam
The function that validates a new branch name was clumsy because, 1. It did more than just validating the branch name 2. Despite it's name, it is more often than not used to validate existing branch names through the 'force' and 'attr_only' parameters (whose names by the way weren't