From: Junio C Hamano Date: Fri, 02 Oct 2015 20:45:23 GMT Subject: Re: [PATCH 1/9] ref-filter: implement %(if), %(then), and %(else) atoms Message-ID: In-Reply-To: <1443807546-5985-2-git-send-email-Karthik.188@gmail.com> Karthik Nayak writes: > +static int is_empty(const char * s){ > + while (*s != '\0') { > + if (!isspace(*s)) > + return 0; > + s++; > + } > + return 1; > +} My knee-jerk reaction was "why is space so special?", but if a caller really cared, it can do "%(if:not_equal=)%(something)%(then)" to unignore spaces in %(something), so it is not a huge deal. It may be that ignoring spaces when checking if something is empty is so common that this default is useful---I cannot tell offhand. > +if:: > + Used as %(if)..%(then)..(%end) or %(if)..%(then)..%(else)..%(end). > + If there is an atom with value or string literal after the > + %(if) then everything after the %(then) is printed, else if > + the %(else) atom is used, then everything after %(else) is > + printed. I notice that "we ignore space when evaluating the string before %(then)" is not mentioned here. That fact, and an example or two that illustrates the situation where this "ignore spaces" behaviour is useful, would be a good thing to document here. Thanks.