Re: [WIP/PATCH v4 1/8] for-each-ref: extract helper functions out of grab_single_ref()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/31/2015 11:04 PM, Junio C Hamano wrote:
Karthik Nayak <karthik.188@xxxxxxxxx> writes:

  /*
+ * Given a refname, return 1 if the refname matches with one of the patterns
+ * while the pattern is a pathname like 'refs/tags' or 'refs/heads/master'
+ * and so on, else return 0. Supports use of wild characters.
+ */
+static int match_name_as_path(const char **pattern, const char *refname)
+{

I wonder why this is not "match_refname", in other words, what the
significance of "as path" part of the name?  If you later are going
to introuce match_name_as_something_else() and that name may not be
a refname, then this naming is perfectly sane.  If such a function
you will later introduce will still deal with names that are only
refnames, then match_refname_as_path() would be sensible.  Otherwise
this name seems overly long (i.e. "as_path" may not be adding value)
while not being desctiptive enough (i.e. is meant to be limited to
refnames but just says "name").

Just being curious.


Good Question, This is because in the future I'll eventually add pattern
matching for 'tag -l' and 'branch -l' which wont match as path, but
would be a regular string match (with wild character support). Hence
keeping that in mind I included 'as_path()' in the function name.


The comment still is a good reminder for those who will later touch
this grab_single_ref() function to make them think twice.

Thanks.


Yes! It was removed it by mistake.

--
Regards,
Karthik
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]