Re: [PATCH v5 3/4] submodule: port set_name_rev() from shell to C

2017-09-24 Thread Junio C Hamano
Junio C Hamano writes: > Nicely done. > >> +if (!capture_command(&cp, &sb, 0) && sb.len) { > ... > So, while it is not wrong per-se, I do not think we need to check > revname[0] here. The helper never returns a non-NULL pointer that > points at an empty string, right? > > On the othe

Re: [PATCH v5 3/4] submodule: port set_name_rev() from shell to C

2017-09-24 Thread Junio C Hamano
Prathamesh Chavan writes: > +static char *compute_rev_name(const char *sub_path, const char* object_id) > +{ > + struct strbuf sb = STRBUF_INIT; > + const char ***d; > + > + static const char *describe_bare[] = { > + NULL > + }; > +... > + static const char **descr

[PATCH v5 3/4] submodule: port set_name_rev() from shell to C

2017-09-24 Thread Prathamesh Chavan
Function set_name_rev() is ported from git-submodule to the submodule--helper builtin. The function compute_rev_name() generates the value of the revision name as required. The function get_rev_name() calls compute_rev_name() and receives the revision name, and later handles its formatting and prin