Re: [RFC/PATCH 4/9] parse-options: add parse_opt_merge_filter()

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [RFC/PATCH 4/9] parse-options: add parse_opt_merge_filter()

From: Matthieu Moy <hidden>
Date: 2016-06-15 23:05:12

Karthik Nayak [off-list ref] writes:
+int parse_opt_merge_filter(const struct option *opt, const char *arg, int unset)
+{
+	struct ref_filter *rf = opt->value;
+	unsigned char sha1[20];
+
+	rf->merge = opt->long_name[0] == 'n'
+		? REF_FILTER_MERGED_OMIT
+		: REF_FILTER_MERGED_INCLUDE;
I would use starts_with("no-", opt->long_name) instead. I had a hard
time understanding why the letter 'n' was special while the
starts_with() version is self-explanatory.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

Re: [RFC/PATCH 4/9] parse-options: add parse_opt_merge_filter()

From: Karthik Nayak <hidden>
Date: 2016-06-15 23:05:12

On 06/08/2015 11:28 PM, Matthieu Moy wrote:
Karthik Nayak [off-list ref] writes:
quoted
+int parse_opt_merge_filter(const struct option *opt, const char *arg, int unset)
+{
+	struct ref_filter *rf = opt->value;
+	unsigned char sha1[20];
+
+	rf->merge = opt->long_name[0] == 'n'
+		? REF_FILTER_MERGED_OMIT
+		: REF_FILTER_MERGED_INCLUDE;
I would use starts_with("no-", opt->long_name) instead. I had a hard
time understanding why the letter 'n' was special while the
starts_with() version is self-explanatory.
Can do that also :)

-- 
Regards,
Karthik
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help